|
scsl 1.0.1
Shimmering Clarity Standard Library
|
Point2D is a cartesian (X,Y) pairing. More...
#include <Coord2D.h>


Public Member Functions | |
| Point2D () | |
| A Point2D defaults to (0,0). | |
| Point2D (int _x, int _y) | |
| Initialize a Point2D At (_x, _y). | |
| Point2D (const Polar2D &pol) | |
| Initialize a Point2D from a Polar2D coordinate. | |
| int | X () const |
| Return the X component of the point. | |
| void | X (int _x) |
| Set the X component of the point. | |
| int | Y () const |
| Return the Y component of the point. | |
| void | Y (int _y) |
| Set the Y component of the point. | |
| std::string | ToString () |
| ToString returns a string in the format (x,y). | |
| void | ToPolar (Polar2D &) |
| ToPolar converts the Point2D to a polar coordinate in-place. | |
| void | Rotate (Point2D &rotated, double theta) |
| Rotate rotates the point by theta radians. | |
| std::vector< Point2D > | Rotate (std::vector< Polar2D > vertices, double theta) |
| Rotate this point around a series of vertices. | |
| void | Translate (const Point2D &other, Point2D &translated) |
| Translate adds this point to the first argument, storing the result in the second argument. | |
| int | Distance (const Point2D &other) const |
| Distance returns the distance from this point to another. | |
Public Member Functions inherited from scmp::geom::Vector< int, 2 > | |
| Vector () | |
| Construct a unit vector of a given type and size. | |
| Vector (std::initializer_list< int > ilst) | |
| Construct a Vector with initial values. | |
| int | At (size_t index) const |
| Return the element At index i. | |
| void | Set (size_t index, int value) |
| Set a new value for the vector. | |
| int | Magnitude () const |
| Compute the length of the vector. | |
| void | SetEpsilon (int 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. | |
| int | Angle (const Vector< int, N > &other) const |
| Compute the Angle between two vectors. | |
| bool | IsParallel (const Vector< int, N > &other) const |
| Determine whether two vectors are parallel. | |
| bool | IsOrthogonal (const Vector< int, N > &other) const |
| Determine if two vectors are orthogonal or perpendicular to each other. | |
| Vector | ProjectParallel (const Vector< int, N > &basis) const |
| Project this vector onto some basis vector. | |
| Vector | ProjectOrthogonal (const Vector< int, N > &basis) |
| Project this vector perpendicularly onto some basis vector. | |
| Vector | Cross (const Vector< int, N > &other) const |
| Compute the cross product of two vectors. | |
| Vector | operator+ (const Vector< int, N > &other) const |
| Vector addition. | |
| Vector | operator- (const Vector< int, N > &other) const |
| Vector subtraction. | |
| Vector | operator* (const int k) const |
| Scalar multiplication. | |
| int | operator* (const Vector< int, N > &other) const |
| Compute the Dot product between two vectors. | |
| Vector | operator/ (const int k) const |
| Scalar division. | |
| bool | operator== (const Vector< int, N > &other) const |
| Vector equivalence. | |
| bool | operator!= (const Vector< int, N > &other) const |
| Vector non-equivalence. | |
| const int & | operator[] (size_t i) const |
| Array indexing into vector. | |
Friends | |
| std::ostream & | operator<< (std::ostream &outs, const Point2D &pt) |
Point2D is a cartesian (X,Y) pairing.
| scmp::geom::Point2D::Point2D | ( | ) |
A Point2D defaults to (0,0).
Distance returns the distance from this point to another.
Rotate rotates the point by theta radians.
| rotated | Stores the rotated point. |
| theta | The Angle (in radians) to Rotate the point. |
| std::vector< Point2D > scmp::geom::Point2D::Rotate | ( | std::vector< Polar2D > | vertices, |
| double | theta | ||
| ) |
Rotate this point around a series of vertices.
| vertices | A series of vertices to Rotate this point around. |
| theta | The Angle to Rotate by. |
ToPolar converts the Point2D to a polar coordinate in-place.
| std::string scmp::geom::Point2D::ToString | ( | ) |
ToString returns a string in the format (x,y).
Translate adds this point to the first argument, storing the result in the second argument.
| other | The point to translate by. |
| translated | The point to store the translation in. |
| int scmp::geom::Point2D::X | ( | ) | const |
Return the X component of the point.
| int scmp::geom::Point2D::Y | ( | ) | const |
Return the Y component of the point.