Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Polar_Point Class Reference

Polar representation of a 2D point. More...

#include <point.H>

Inheritance diagram for Polar_Point:
[legend]
Collaboration diagram for Polar_Point:
[legend]

Public Types

enum  Quadrant { First , Second , Third , Fourth }
 Enumerate polar quadrants in counterclockwise order. More...
 

Public Member Functions

const Geom_Numberget_r () const
 Returns the magnitude.
 
const Geom_Numberget_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
 

Detailed Description

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.

Author
Leandro Rabindranath León

Definition at line 342 of file point.H.

Member Enumeration Documentation

◆ Quadrant

Enumerate polar quadrants in counterclockwise order.

Enumerator
First 
Second 
Third 
Fourth 

Definition at line 373 of file point.H.

Constructor & Destructor Documentation

◆ Polar_Point() [1/3]

Polar_Point::Polar_Point ( const Geom_Number __r,
const Geom_Number __theta 
)
inline

Definition at line 356 of file point.H.

◆ Polar_Point() [2/3]

Polar_Point::Polar_Point ( const Point p)
inline

Construct from Cartesian coordinates (origin at (0,0)).

Definition at line 363 of file point.H.

References arctan2(), pitag(), r, theta, Point::x, y, and Point::y.

◆ Polar_Point() [3/3]

Polar_Point::Polar_Point ( )
inline

Definition at line 398 of file point.H.

Member Function Documentation

◆ get_quadrant()

Quadrant Polar_Point::get_quadrant ( ) const
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.

◆ get_r()

const Geom_Number & Polar_Point::get_r ( ) const
inline

Returns the magnitude.

Definition at line 351 of file point.H.

References r.

Referenced by Segment::mid_perpendicular(), and Segment::rotate().

◆ get_theta()

const Geom_Number & Polar_Point::get_theta ( ) const
inline

Returns the angle.

Definition at line 354 of file point.H.

References theta.

Referenced by Segment::mid_perpendicular(), and Segment::rotate().

◆ to_string()

std::string Polar_Point::to_string ( ) const
inline

Convert to string representation "[r,theta]".

Definition at line 392 of file point.H.

References geom_number_to_double(), r, and theta.

Friends And Related Symbol Documentation

◆ Point

friend class Point
friend

Definition at line 344 of file point.H.

Member Data Documentation

◆ r

Geom_Number Polar_Point::r
private

Definition at line 346 of file point.H.

Referenced by Polar_Point(), get_r(), and to_string().

◆ theta

Geom_Number Polar_Point::theta
private

Definition at line 347 of file point.H.

Referenced by Polar_Point(), get_theta(), and to_string().


The documentation for this class was generated from the following file: