This class is designed to be base class of more specific types of 2D points. Specifically, 2D points in different coordinate systems. The template argument P is the type of the derived point class. This allows the Point2 to return new points of the same type as the derived class. The template argument V is the type of the corresponding 2D vector class for the coordinate system of the derived 2D point class. More...
#include <point2.H>
Inheritance diagram for mlib::Point2< P, V >:
Descriptive interface | |
typedef double | value_type |
static int | dim () |
Public Member Functions | |
Constructors | |
Point2 () | |
Default constructor. Creates a point at the origin. | |
Point2 (double s) | |
Constructor that creates a point with the supplied double argumetn value in all components. | |
Point2 (double xx, double yy) | |
Construtor that creates a point with the components supplied in the arguments. | |
Element Access Functions | |
const double * | data () const |
Returns the elements of the point as an array. | |
double | operator[] (int index) const |
double & | operator[] (int index) |
Overloaded Arithmetic Operators | |
P | operator+ (const P &p) const |
Adds a point to a point. | |
P | operator+ (const V &v) const |
V | operator- (const P &p) const |
P | operator- (const V &v) const |
P | operator- () const |
P | operator * (double s) const |
P | operator/ (double s) const |
P | operator * (const P &p) const |
Component-wise multiplcation. | |
void | operator *= (const P &p) const |
Component-wise multiplication. | |
void | operator+= (const P &p) |
Adds a point to a point. | |
void | operator+= (const V &v) |
void | operator-= (const P &p) |
void | operator-= (const V &v) |
void | operator *= (double scalar) |
void | operator/= (double scalar) |
Overloaded Comparison Operators | |
bool | operator== (const P &p) const |
Are the two points exactly equal (component-wise)? | |
bool | operator!= (const P &p) const |
Are the two points not equal (component-wise)? | |
Point Property Queries | |
double | length () const |
Compute the distance from the point to the origin. | |
double | length_sqrd () const |
Compute the distance squared from the point to the origin. | |
Two Point Operations | |
double | dist_sqrd (const P &p) const |
Compute the distance squared between two points. | |
double | dist (const P &p) const |
Compute the distance between two points. | |
Point Comparison Functions | |
bool | is_equal (const P &p, double epsSqrd=epsAbsSqrdMath()) const |
Is the distance between the two points essentially zero? | |
Protected Attributes | |
double | _x |
double | _y |
Related Functions | |
(Note that these are not member functions.) | |
ostream & | operator<< (ostream &os, const Point2< P, V > &p) |
Stream instertion operator for Point2's. | |
double | det (const Point2< P, V > &a, const Point2< P, V > &b) |
Computes the determinant of the 2x2 matrix with the components of the points as rows. |
This class is designed to be base class of more specific types of 2D points. Specifically, 2D points in different coordinate systems. The template argument P is the type of the derived point class. This allows the Point2 to return new points of the same type as the derived class. The template argument V is the type of the corresponding 2D vector class for the coordinate system of the derived 2D point class.
Definition at line 32 of file point2.H.
|
|
|
Default constructor. Creates a point at the origin.
|
|
Constructor that creates a point with the supplied double argumetn value in all components.
|
|
Construtor that creates a point with the components supplied in the arguments.
|
|
Returns the elements of the point as an array.
Definition at line 66 of file point2.H. Referenced by GestureBoxDrawer::draw(), DEBUG_ELLIPSE::draw(), SmoothShadeStripCB::faceCB(), StripTexCoordsCB2::faceCB(), FlatShadeStripCB::faceCB(), and StripTexCoordsCB3::faceCB(). |
|
|
|
Compute the distance between two points.
Definition at line 138 of file point2.H. Referenced by GESTURE::dist(), Cam_int::dragup(), Cam_int_fp::dragup(), GESTURE::endpoint_dist(), GESTURE::is_x(), Cam_int::up(), and Cam_int_fp::up(). |
|
Compute the distance squared between two points.
Definition at line 135 of file point2.H. Referenced by mlib::Point2< NDCpt, NDCvec >::dist(), mlib::Point2< NDCpt, NDCvec >::is_equal(), and Bface::ndc_walk(). |
|
Is the distance between the two points essentially zero?
|
|
Compute the distance from the point to the origin.
|
|
Compute the distance squared from the point to the origin.
|
|
Component-wise multiplcation.
|
|
|
|
|
|
Component-wise multiplication.
|
|
Are the two points not equal (component-wise)?
|
|
|
|
Adds a point to a point.
|
|
|
|
Adds a point to a point.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Are the two points exactly equal (component-wise)?
|
|
|
|
|
|
Computes the determinant of the 2x2 matrix with the components of the points as rows.
|
|
Stream instertion operator for Point2's.
|
|
|