|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Polar representation of a 2D point. More...
#include <point.H>
Public Types | |
| enum | Quadrant { First , Second , Third , Fourth } |
| Enumerate polar quadrants in counterclockwise order. More... | |
Public Member Functions | |
| const Geom_Number & | get_r () const |
| Returns the magnitude. | |
| const Geom_Number & | get_theta () const |
| Returns the angle. | |
| Polar_Point (const Geom_Number &__r, const Geom_Number &__theta) | |
| Polar_Point (const Point &p) | |
| Construct from Cartesian coordinates (origin at (0,0)). | |
| Quadrant | get_quadrant () const |
| Return the quadrant where the point lies (origin defaults to First). | |
| std::string | to_string () const |
| Convert to string representation "[r,theta]". | |
| Polar_Point () | |
Public Member Functions inherited from Geom_Object | |
| Geom_Object ()=default | |
| virtual | ~Geom_Object ()=default |
Private Attributes | |
| Geom_Number | r |
| Geom_Number | theta |
Friends | |
| class | Point |
Polar representation of a 2D point.
Polar coordinates are convenient for algorithms that rely on angles or rotations. Instances can be constructed from rectangular coordinates and are convertible back into Point objects.
|
inline |
|
inline |
|
inline |
Return the quadrant where the point lies (origin defaults to First).
Definition at line 376 of file point.H.
References First, Fourth, Point::get_x(), Point::get_y(), Second, and Third.
|
inline |
Returns the magnitude.
Definition at line 351 of file point.H.
References r.
Referenced by Segment::mid_perpendicular(), and Segment::rotate().
|
inline |
Returns the angle.
Definition at line 354 of file point.H.
References theta.
Referenced by Segment::mid_perpendicular(), and Segment::rotate().
|
inline |
Convert to string representation "[r,theta]".
Definition at line 392 of file point.H.
References geom_number_to_double(), r, and theta.
|
private |
Definition at line 346 of file point.H.
Referenced by Polar_Point(), get_r(), and to_string().
|
private |
Definition at line 347 of file point.H.
Referenced by Polar_Point(), get_theta(), and to_string().