scsl 1.0.1
Shimmering Clarity Standard Library
|
Polar2D is a pairing of a radius r and angle θ from some reference point; in this library, it is assumed to be the Cartesian origin (0, 0). More...
#include <Coord2D.h>
Public Member Functions | |
Polar2D () | |
Construct a zero polar coordinate. | |
Polar2D (double _r, double _theta) | |
Construct a polar coordinate from a radius and angle. | |
Polar2D (const Point2D &point) | |
Construct a polar coordinate from a point. | |
double | R () const |
Return the radius component of this coordinate. | |
void | R (const double _r) |
Set the radius component of this coordinate. | |
double | Theta () const |
Return the angle component of this coordinate. | |
void | Theta (const double _theta) |
Set the angle component of this coordinate. | |
std::string | ToString () |
Return the coordinate in string form. | |
void | ToPoint (Point2D &point) |
Construct a Point2D representing this Polar2D. | |
void | Rotate (Polar2D &rotated, double delta) |
Rotate polar coordinate by some angle. | |
void | RotateAround (const Point2D &other, Point2D &result, double delta) |
Rotate this polar coordinate around a 2D point. | |
Public Member Functions inherited from scmp::geom::Vector< double, 2 > | |
Vector () | |
Construct a unit vector of a given type and size. | |
Vector (std::initializer_list< double > ilst) | |
Construct a Vector with initial values. | |
double | At (size_t index) const |
Return the element At index i. | |
void | Set (size_t index, double value) |
Set a new value for the vector. | |
double | Magnitude () const |
Compute the length of the vector. | |
void | SetEpsilon (double eps) |
Set equivalence tolerance. | |
bool | IsZero () const |
Determine whether this is a zero vector. | |
Vector | UnitVector () const |
Obtain the unit vector for this vector. | |
bool | IsUnitVector () const |
Determine if this is a unit vector. | |
double | Angle (const Vector< double, N > &other) const |
Compute the Angle between two vectors. | |
bool | IsParallel (const Vector< double, N > &other) const |
Determine whether two vectors are parallel. | |
bool | IsOrthogonal (const Vector< double, N > &other) const |
Determine if two vectors are orthogonal or perpendicular to each other. | |
Vector | ProjectParallel (const Vector< double, N > &basis) const |
Project this vector onto some basis vector. | |
Vector | ProjectOrthogonal (const Vector< double, N > &basis) |
Project this vector perpendicularly onto some basis vector. | |
Vector | Cross (const Vector< double, N > &other) const |
Compute the cross product of two vectors. | |
Vector | operator+ (const Vector< double, N > &other) const |
Vector addition. | |
Vector | operator- (const Vector< double, N > &other) const |
Vector subtraction. | |
Vector | operator* (const double k) const |
Scalar multiplication. | |
double | operator* (const Vector< double, N > &other) const |
Compute the Dot product between two vectors. | |
Vector | operator/ (const double k) const |
Scalar division. | |
bool | operator== (const Vector< double, N > &other) const |
Vector equivalence. | |
bool | operator!= (const Vector< double, N > &other) const |
Vector non-equivalence. | |
const double & | operator[] (size_t i) const |
Array indexing into vector. | |
Friends | |
std::ostream & | operator<< (std::ostream &, const Polar2D &) |
Polar2D is a pairing of a radius r and angle θ from some reference point; in this library, it is assumed to be the Cartesian origin (0, 0).
scmp::geom::Polar2D::Polar2D | ( | ) |
Construct a polar coordinate from a radius and angle.
_r | A radius |
_theta | An angle |
Construct a polar coordinate from a point.
This construct uses the origin (0,0) as the reference point.
point | A 2D Cartesian point. |
double scmp::geom::Polar2D::R | ( | ) | const |
Return the radius component of this coordinate.
Rotate polar coordinate by some angle.
rotated | The rotated Polar2D will be stored in this coordinate. |
delta | The angle to rotate by. |
Rotate this polar coordinate around a 2D point.
other | The reference point. |
result | The point where the result will stored. |
delta | The angle to rotate by. |
double scmp::geom::Polar2D::Theta | ( | ) | const |
Return the angle component of this coordinate.
std::string scmp::geom::Polar2D::ToString | ( | ) |
Return the coordinate in string form.