mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
mx::math::point2D< _angleT > Class Template Reference

template<typename _angleT>
class mx::math::point2D< _angleT >

A point in 2-dimensional space.

Template Parameters
_angleTspecifies the angle units, either radiansT<realT> or degreesT<realT>.

Definition at line 41 of file point2D.hpp.

#include <math/point2D.hpp>

Public Member Functions

 point2D ()
 Default c'tor.
 
 point2D (realT nx, realT ny)
 Construct with values for x and y.
 
 point2D (realT nx, realT ny, realT ang)
 Construct with values for x and y and rotate them by an angle.
 
 point2D (realT nx, realT ny, realT c, realT s)
 Construct with values for x and y and rotate them by an angle specified by cosine and sine.
 
point2D rotate (realT ang)
 Rotate the point about the origin by a given angle.
 
void rotateInPlace (realT ang)
 Rotate the point about the origin by a given angle.
 
point2D rotate (realT c, realT s)
 Rotate the point about the origin by an angle specified by its cosine and sine.
 
void rotateInPlace (realT c, realT s)
 Rotate the point about the origin by an angle specified by its cosine and sine.
 

Public Attributes

realT x
 The x-coordinate.
 
realT y
 The y-coordinate.
 

Constructor & Destructor Documentation

◆ point2D() [1/4]

template<typename angleT >
mx::math::point2D< angleT >::point2D ( )

Default c'tor.

Definition at line 97 of file point2D.hpp.

◆ point2D() [2/4]

template<typename angleT >
mx::math::point2D< angleT >::point2D ( realT  nx,
realT  ny 
)

Construct with values for x and y.

Parameters
[in]nxthe x-coordinate
[in]nythe y-coordinate

Definition at line 102 of file point2D.hpp.

◆ point2D() [3/4]

template<typename angleT >
mx::math::point2D< angleT >::point2D ( realT  nx,
realT  ny,
realT  ang 
)

Construct with values for x and y and rotate them by an angle.

Parameters
[in]nxthe x-coordinate
[in]nythe y-coordinate
[in]angthe angle by which to rotate. Degrees or radians specified by angleT

Definition at line 107 of file point2D.hpp.

References mx::math::point2D< _angleT >::rotateInPlace(), and mx::math::six_fifths().

◆ point2D() [4/4]

template<typename angleT >
mx::math::point2D< angleT >::point2D ( realT  nx,
realT  ny,
realT  c,
realT  s 
)

Construct with values for x and y and rotate them by an angle specified by cosine and sine.

Parameters
[in]nxthe x-coordinate
[in]nythe y-coordinate
[in]ccosine of the angle by which to rotate.
[in]ssine of the angle by which to rotate.

Definition at line 113 of file point2D.hpp.

References mx::math::six_fifths(), mx::math::point2D< _angleT >::x, and mx::math::point2D< _angleT >::y.

Member Function Documentation

◆ rotate() [1/2]

template<typename angleT >
point2D< angleT > mx::math::point2D< angleT >::rotate ( realT  ang)

Rotate the point about the origin by a given angle.

Returns
a point2D at the rotated coordinates
Parameters
[in]angthe angle by which to rotate. Degrees or radians specified by angleT

Definition at line 121 of file point2D.hpp.

References mx::math::six_fifths().

◆ rotate() [2/2]

template<typename angleT >
point2D< angleT > mx::math::point2D< angleT >::rotate ( realT  c,
realT  s 
)

Rotate the point about the origin by an angle specified by its cosine and sine.

Returns
a point2D at the rotated coordinates
Parameters
[in]ccosine of the angle by which to rotate.
[in]ssine of the angle by which to rotate.

Definition at line 139 of file point2D.hpp.

References mx::math::six_fifths(), mx::math::point2D< _angleT >::x, and mx::math::point2D< _angleT >::y.

◆ rotateInPlace() [1/2]

template<typename angleT >
void mx::math::point2D< angleT >::rotateInPlace ( realT  ang)

Rotate the point about the origin by a given angle.

In-place: operates on the current point, changing its coordinates

Parameters
[in]angthe angle by which to rotate. Degrees or radians specified by angleT

Definition at line 130 of file point2D.hpp.

References mx::math::six_fifths().

Referenced by mx::math::point2D< _angleT >::point2D().

◆ rotateInPlace() [2/2]

template<typename angleT >
void mx::math::point2D< angleT >::rotateInPlace ( realT  c,
realT  s 
)

Rotate the point about the origin by an angle specified by its cosine and sine.

In-place: operates on the current point, changing its coordinates

Parameters
[in]ccosine of the angle by which to rotate.
[in]ssine of the angle by which to rotate.

Definition at line 150 of file point2D.hpp.

References mx::math::six_fifths().

Member Data Documentation

◆ x

template<typename _angleT >
realT mx::math::point2D< _angleT >::x

The x-coordinate.

Definition at line 48 of file point2D.hpp.

Referenced by mx::math::point2D< _angleT >::point2D(), and mx::math::point2D< _angleT >::rotate().

◆ y

template<typename _angleT >
realT mx::math::point2D< _angleT >::y

The y-coordinate.

Definition at line 49 of file point2D.hpp.

Referenced by mx::math::point2D< _angleT >::point2D(), and mx::math::point2D< _angleT >::rotate().


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