|
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 } |
| Enumerates polar quadrants in counterclockwise order. More... | |
Public Member Functions | |
| const Geom_Number & | get_r () const |
| Gets the radius (magnitude) of the polar point. | |
| const Geom_Number & | get_theta () const |
| Gets the angle (theta) of the polar point. | |
| Polar_Point (const Geom_Number &r, const Geom_Number &theta) | |
| Constructs a polar point from a radius and an angle. | |
| Polar_Point (const Point &p) | |
| Constructs a polar point from a Cartesian point. | |
| Quadrant | get_quadrant () const |
| Returns the quadrant where the point lies. | |
| std::string | to_string () const |
| Converts the polar point to a string representation "[r,theta]". | |
| Polar_Point ()=default | |
| Default constructor. | |
Public Member Functions inherited from Aleph::Geom_Object | |
| Geom_Object ()=default | |
| virtual | ~Geom_Object ()=default |
Private Attributes | |
| Geom_Number | r_ = 0 |
| Geom_Number | theta_ = 0 |
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 Cartesian coordinates and are convertible back into Point objects.
|
inline |
Constructs a polar point from a Cartesian point.
| p | The Cartesian point to convert. The origin is assumed to be (0,0). |
Definition at line 760 of file point.H.
References Aleph::arctan2(), Aleph::euclidean_distance(), Aleph::Point::get_x(), Aleph::Point::get_y(), r_, theta_, and y.
|
default |
Default constructor.
|
inline |
Returns the quadrant where the point lies.
Quadrant enum value. Definition at line 777 of file point.H.
References Aleph::and, Aleph::divide_and_conquer_partition_dp(), First, Fourth, Aleph::Point::get_x(), Aleph::Point::get_y(), Second, and Third.
|
inline |
|
inline |
|
inline |
Converts the polar point to a string representation "[r,theta]".
std::string representing the polar coordinates. Definition at line 796 of file point.H.
References Aleph::geom_number_to_double(), r_, and theta_.
|
private |
Definition at line 729 of file point.H.
Referenced by Polar_Point(), get_r(), and to_string().
|
private |
Definition at line 730 of file point.H.
Referenced by Polar_Point(), get_theta(), and to_string().