diff --git a/owlps-positioner/src/autocalibration.cc b/owlps-positioner/src/autocalibration.cc index 3f1427d..e3a3b78 100644 --- a/owlps-positioner/src/autocalibration.cc +++ b/owlps-positioner/src/autocalibration.cc @@ -86,6 +86,13 @@ void Autocalibration::generate_ss() if (rx_coord.get_z() != point.get_z()) return ; + /* Compute the origin angle P-RX-O */ + Point3D origin(rx_coord) ; + origin.set_x(rx_coord.get_x() + 10) ; + origin_angle = rx_coord.angle_2d(point, origin) ; + if (point.get_y() > rx_coord.get_y()) + origin_angle = -origin_angle ; + /* Choose the nearest AP(s) in angle */ sort_reference_aps() ; // We need at least one reference AP: @@ -146,7 +153,7 @@ void Autocalibration::sort_reference_aps() /* Rotate the AP's coordinates to know the angle direction */ Point3D ref_coord_r(ref_coord) ; - ref_coord_r.rotate_2d(rx_coord, angle_p) ; + ref_coord_r.rotate_2d(rx_coord, origin_angle) ; // Insert the AP in the right list, according to the direction: if (ref_coord_r.get_y() < rx_coord.get_y()) sorted_negative_angles.insert(weight_angle_ap) ; diff --git a/owlps-positioner/src/autocalibration.hh b/owlps-positioner/src/autocalibration.hh index 7b9347d..2072f3b 100644 --- a/owlps-positioner/src/autocalibration.hh +++ b/owlps-positioner/src/autocalibration.hh @@ -32,7 +32,7 @@ private: /// Current AP to generate a SS for std::tr1::unordered_map::const_iterator rx ; /// Angle P-RX-O, O being the origin of the trigonometric circle - float angle_p ; + float origin_angle ; /// Selected transmitter APs std::vector ref_aps ; /// \brief Angles of the transmitter APs (before M on the trigonometric