#include <MPoint.h>
Implementation of a point.
This class provides an implementation of a point. Numerous convienence operators are provided to help with the manipulation of points. This includes operators that work with the MVector and MMatrix classes.
All methods that query the point are threadsafe, all methods that modify the point are not threadsafe.
Public Member Functions | |
MPoint () | |
Default constructor. More... | |
MPoint (const MPoint &srcpt) | |
Copy constructor. More... | |
MPoint (const MFloatPoint &srcpt) | |
Creates an new instance and initializes it to the x, y, z, w values of the given MFloatPoint. More... | |
MPoint (const MVector &src) | |
Creates an new instance and initializes it to the x, y, z values of the given MVector. More... | |
MPoint (const MFloatVector &src) | |
Creates an new instance and initializes it to the x, y, z values of the given MFloatVector. More... | |
MPoint (double xx, double yy, double zz=0.0, double ww=1.0) | |
Create a new instance and initialize it to the given position. More... | |
MPoint (const double d[4]) | |
Create a new instance and initialize it to the given position. More... | |
MPoint (const float d[4]) | |
Create a new instance and initialize it to the given position. More... | |
~MPoint () | |
Class destructor. | |
MStatus | get (double[4]) const |
Copy the values of x, y, z, and w from the instance to the four elements of the given array of doubles. More... | |
MStatus | get (float[4]) const |
Copy the values of x, y, z, and w from the instance to the four elements of the given array of floats. More... | |
double | operator[] (unsigned int i) const |
The index operator. More... | |
double | operator() (unsigned int i) const |
The index operator. More... | |
MPoint & | operator= (const MPoint &src) |
The assignment operator. More... | |
MVector | operator- (const MPoint &other) const |
The subtraction operator for two MPoints. More... | |
MPoint | operator+ (const MVector &other) const |
The addition operator for adding an MVector to an MPoint. More... | |
MPoint | operator- (const MVector &other) const |
The addition operator for subtracting an MVector from an MPoint. More... | |
MPoint & | operator+= (const MVector &vector) |
The in-place addition operator for adding an MVector to an MPoint. More... | |
MPoint & | operator-= (const MVector &vector) |
The in-place subtraction operator for subtracting an MVector from an MPoint. More... | |
MPoint | operator* (const int scale) const |
The multipication operator that allows the vector to by scaled by the given parameter. More... | |
MPoint | operator* (const short scale) const |
The multipication operator that allows the vector to by scaled by the given parameter. More... | |
MPoint | operator* (const unsigned int scale) const |
The multipication operator that allows the vector to by scaled by the given parameter. More... | |
MPoint | operator* (const unsigned short scale) const |
The multipication operator that allows the vector to by scaled by the given parameter. More... | |
MPoint | operator* (const float scale) const |
The multipication operator that allows the vector to by scaled by the given parameter. More... | |
MPoint | operator* (const double scale) const |
The multipication operator that allows the vector to by scaled by the given parameter. More... | |
MPoint | operator/ (const double scale) const |
The division operator that allows the vector to by scaled by the given double parameter. More... | |
MPoint | operator* (const MMatrix &) const |
The multiplication operator for computing the product of this point instance with the given matrix. More... | |
MPoint & | operator*= (const MMatrix &) |
The in-place multiplication operator for computing the product of this point instance with the given matrix. More... | |
MPoint & | operator*= (const int) |
The in-place multiplication operator for computing the scalar product of this point instance with the given scalar. More... | |
MPoint & | operator*= (const short) |
The in-place multiplication operator for computing the scalar product of this point instance with the given scalar. More... | |
MPoint & | operator*= (const unsigned int) |
The in-place multiplication operator for computing the scalar product of this point instance with the given scalar. More... | |
MPoint & | operator*= (const unsigned short) |
The in-place multiplication operator for computing the scalar product of this point instance with the given scalar. More... | |
MPoint & | operator*= (const float) |
The in-place multiplication operator for computing the scalar product of this point instance with the given scalar. More... | |
MPoint & | operator*= (const double) |
The in-place multiplication operator for computing the scalar product of this point instance with the given scalar. More... | |
bool | operator== (const MPoint &other) const |
The equality operator. More... | |
bool | operator!= (const MPoint &other) const |
The inequality operator. More... | |
MPoint & | cartesianize () |
If this point instance is of the form P(W*x, W*y, W*z, W), for some scale factor W != 0, then it is reset to be P(x, y, z, 1). More... | |
MPoint & | rationalize () |
If this point instance is of the form P(W*x, W*y, W*z, W) (ie. More... | |
MPoint & | homogenize () |
If this point instance is of the form P(x, y, z, W) (ie. More... | |
double | distanceTo (const MPoint &other) const |
Return the distance between this instance and the point passed as an argument. More... | |
bool | isEquivalent (const MPoint &other, double tolerance=MPoint_kTol) const |
Returns true if this instance of the point passed as an argument represent the same position within the specified tolerance. More... | |
double & | operator[] (unsigned int i) |
NO SCRIPT SUPPORT. More... | |
double & | operator() (unsigned int i) |
NO SCRIPT SUPPORT. More... | |
Static Public Member Functions | |
static const char * | className () |
Returns the name of this class. More... | |
Public Attributes | |
double | x |
the x component of the point | |
double | y |
the y component of the point | |
double | z |
the z component of the point | |
double | w |
the w component of the point | |
Static Public Attributes | |
static const MPoint | origin |
A constant representing the origin - (0,0,0,1). | |
Friends | |
OPENMAYA_EXPORT MPoint | operator* (int, const MPoint &) |
NO SCRIPT SUPPORT. More... | |
OPENMAYA_EXPORT MPoint | operator* (short, const MPoint &) |
NO SCRIPT SUPPORT. More... | |
OPENMAYA_EXPORT MPoint | operator* (unsigned int, const MPoint &) |
NO SCRIPT SUPPORT. More... | |
OPENMAYA_EXPORT MPoint | operator* (unsigned short, const MPoint &) |
NO SCRIPT SUPPORT. More... | |
OPENMAYA_EXPORT MPoint | operator* (float, const MPoint &) |
NO SCRIPT SUPPORT. More... | |
OPENMAYA_EXPORT MPoint | operator* (double, const MPoint &) |
NO SCRIPT SUPPORT. More... | |
OPENMAYA_EXPORT MPoint | operator* (const MMatrix &, const MPoint &) |
NO SCRIPT SUPPORT. More... | |
OPENMAYA_EXPORT std::ostream & | operator<< (std::ostream &os, const MPoint &p) |
NO SCRIPT SUPPORT. More... | |
|
inline |
Default constructor.
The instance is initialized to the origin.
Copy constructor.
Creates an new instance and initializes it to the same point as the given point.
[in] | srcpt | The point object to copy from. |
|
inline |
Creates an new instance and initializes it to the x, y, z, w values of the given MFloatPoint.
[in] | srcpt | the point object to copy |
Creates an new instance and initializes it to the x, y, z values of the given MVector.
The w value is set to 1.0.
[in] | src | the vector object to copy |
|
inline |
Creates an new instance and initializes it to the x, y, z values of the given MFloatVector.
The w value is set to 1.0.
[in] | src | the vector object to copy |
|
inline |
Create a new instance and initialize it to the given position.
[in] | xx | The initial value of x. |
[in] | yy | The initial value of y. |
[in] | zz | The initial value of z. |
[in] | ww | The initial value of w. |
|
inline |
Create a new instance and initialize it to the given position.
[in] | d | array of 4 doubles used to initialize x, y, z, and w respectively. |
|
inline |
Create a new instance and initialize it to the given position.
[in] | f | An array of 4 floats used to initialize x, y, z, and w respectively. |
|
inline |
Copy the values of x, y, z, and w from the instance to the four elements of the given array of doubles.
[out] | dest | The four element array of doubles. |
|
inline |
Copy the values of x, y, z, and w from the instance to the four elements of the given array of floats.
[out] | dest | The four element array of floats. |
|
inline |
The index operator.
[in] | i | Value indicating which component to return. |
|
inline |
The index operator.
[in] | i | Value indicating which component to return. |
The assignment operator.
[in] | src | Point to copy from. |
|
inline |
The multipication operator that allows the vector to by scaled by the given parameter.
The x, y, and z components are each multiplied by the parameter. The w component remains unchanged.
[in] | scale | The scale parameter. |
|
inline |
The multipication operator that allows the vector to by scaled by the given parameter.
The x, y, and z components are each multiplied by the parameter. The w component remains unchanged.
[in] | scale | The scale parameter. |
|
inline |
The multipication operator that allows the vector to by scaled by the given parameter.
The x, y, and z components are each multiplied by the parameter. The w component remains unchanged.
[in] | scale | The scale parameter. |
|
inline |
The multipication operator that allows the vector to by scaled by the given parameter.
The x, y, and z components are each multiplied by the parameter. The w component remains unchanged.
[in] | scale | The scale parameter. |
|
inline |
The multipication operator that allows the vector to by scaled by the given parameter.
The x, y, and z components are each multiplied by the parameter. The w component remains unchanged.
[in] | scale | The scale parameter. |
|
inline |
The multipication operator that allows the vector to by scaled by the given parameter.
The x, y, and z components are each multiplied by the parameter. The w component remains unchanged.
[in] | scale | The scale parameter. |
|
inline |
The division operator that allows the vector to by scaled by the given double parameter.
The x, y, and z components are each divided by the parameter. The w component remains unchanged.
[in] | scale | The scale parameter. |
The multiplication operator for computing the product of this point instance with the given matrix.
[in] | right | the MMatrix to right multiply by |
The in-place multiplication operator for computing the product of this point instance with the given matrix.
[in] | right | the MMatrix to right multiply by |
|
inline |
The in-place multiplication operator for computing the scalar product of this point instance with the given scalar.
[in] | factor | Scalar to multiply this point by. |
|
inline |
The in-place multiplication operator for computing the scalar product of this point instance with the given scalar.
[in] | factor | Scalar to multiply this point by. |
|
inline |
The in-place multiplication operator for computing the scalar product of this point instance with the given scalar.
[in] | factor | Scalar to multiply this point by. |
|
inline |
The in-place multiplication operator for computing the scalar product of this point instance with the given scalar.
[in] | factor | Scalar to multiply this point by. |
|
inline |
The in-place multiplication operator for computing the scalar product of this point instance with the given scalar.
[in] | factor | Scalar to multiply this point by. |
|
inline |
The in-place multiplication operator for computing the scalar product of this point instance with the given scalar.
[in] | factor | Scalar to multiply this point by. |
|
inline |
The equality operator.
[in] | other | Point to compare with. |
|
inline |
The inequality operator.
[in] | other | Point to compare with. |
MPoint & cartesianize | ( | ) |
If this point instance is of the form P(W*x, W*y, W*z, W), for some scale factor W != 0, then it is reset to be P(x, y, z, 1).
This will only work correctly if the point is in homogenous form or cartesian form. If the point is in rational form, the results are not defined.
MPoint & rationalize | ( | ) |
If this point instance is of the form P(W*x, W*y, W*z, W) (ie.
is in homogenous or (for W==1) cartesian form), for some scale factor W != 0, then it is reset to be P(x, y, z, W). This will only work correctly if the point is in homogenous or cartesian form. If the point is already in rational form, the resultsare not defined.
MPoint & homogenize | ( | ) |
If this point instance is of the form P(x, y, z, W) (ie.
is in rational or (for W==1) cartesian form), for some scale factor W != 0, then it is reset to be P(W*x, W*y, W*z, W).
|
inline |
Return the distance between this instance and the point passed as an argument.
[in] | other | The point to compute the distance to. |
|
inline |
Returns true if this instance of the point passed as an argument represent the same position within the specified tolerance.
[in] | other | The other point to compare to. |
[in] | tol | The tolerance to use during the comparison. |
|
inline |
NO SCRIPT SUPPORT.
The index operator.
[in] | i | Value indicating which component to return. |
|
inline |
NO SCRIPT SUPPORT.
The index operator.
If the argument is 0 it will return the x component of the instance. If the argument is 1 it will return the y component of the instance. If the argument is 2 it will return the z component of the instance. If the argument is 3 it will return the w component of the instance. Otherwise it will return the x component of the instance.
[in] | i | Value indicating which component to return. |
|
static |
Returns the name of this class.
NO SCRIPT SUPPORT.
The point's x, y, and z components are each multiplied by the scalar. The w component remains unchanged.
[in] | scale | The scale parameter. |
[in] | p | The point to be scaled. |
NO SCRIPT SUPPORT.
The point's x, y, and z components are each multiplied by the scalar. The w component remains unchanged.
[in] | scale | The scale parameter. |
[in] | p | The point to be scaled. |
NO SCRIPT SUPPORT.
The point's x, y, and z components are each multiplied by the scalar. The w component remains unchanged.
[in] | scale | The scale parameter. |
[in] | p | The point to be scaled. |
NO SCRIPT SUPPORT.
The point's x, y, and z components are each multiplied by the scalar. The w component remains unchanged.
[in] | scale | The scale parameter. |
[in] | p | The point to be scaled. |
NO SCRIPT SUPPORT.
The point's x, y, and z components are each multiplied by the scalar. The w component remains unchanged.
[in] | scale | The scale parameter. |
[in] | p | The point to be scaled. |
NO SCRIPT SUPPORT.
The point's x, y, and z components are each multiplied by the scalar. The w component remains unchanged.
[in] | scale | The scale parameter. |
[in] | p | The point to be scaled. |
NO SCRIPT SUPPORT.
[in] | left | the MMatrix to right multiply by |
[in] | right | this point instance |
|
friend |
NO SCRIPT SUPPORT.
The format used is [x, y, z, w].
[in] | os | the ostream to print to |
[in] | p | the MPoint whose value is to be printed |