MFloatPoint Class Reference

#include <MFloatPoint.h>

Class Description

Public Member Functions

 MFloatPoint ()
 Default constructor. More...
 
 MFloatPoint (const MFloatPoint &srcpt)
 Copy constructor. More...
 
 MFloatPoint (const MPoint &srcpt)
 Copy constructor. More...
 
 MFloatPoint (const MFloatVector &src)
 Create a new point and initialize it to the same x, y, z values as the given MFloatVector. More...
 
 MFloatPoint (const MVector &src)
 Create a new point and initialize it to the same x, y, z values as the given MVector. More...
 
 MFloatPoint (float xx, float yy, float zz=0.0, float ww=1.0)
 Create a new instance and initialize it to the given position. More...
 
 MFloatPoint (const float f[4])
 Create a new instance and initialize it to the given position. More...
 
 MFloatPoint (const double d[4])
 Create a new instance and initialize it to the given position. More...
 
 ~MFloatPoint ()
 Class destructor.
 
MStatus get (double dest[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 dest[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...
 
MStatus setCast (const MPoint &srcpt)
 Copy the values of x, y, z, and w from srcpt to the instance. More...
 
MStatus setCast (const MVector &src)
 Copy the values of x, y, z, and w from src to the instance. More...
 
MStatus setCast (const double d[4])
 Copy the values of x, y, z, and w to the instance from the four elements of the given array of doubles. More...
 
MFloatPointoperator= (const MFloatPoint &src)
 The assignment operator. More...
 
float operator() (unsigned int i) const
 The index operator. More...
 
float operator[] (unsigned int i) const
 The index operator. More...
 
MFloatVector operator- (const MFloatPoint &other) const
 The subtraction operator for two MFloatPoints. More...
 
MFloatPoint operator+ (const MFloatVector &other) const
 The operator for adding an MFloatVector to an MFloatPoint. More...
 
MFloatPoint operator- (const MFloatVector &other) const
 The operator for subtracting an MFloatVector from an MFloatPoint. More...
 
MFloatPointoperator+= (const MFloatVector &vector)
 The in-place addition operator for adding an MFloatVector to an MFloatPoint. More...
 
MFloatPointoperator-= (const MFloatVector &vector)
 The in-place subtraction operator for subtracting an MFloatVector from an MFloatPoint. More...
 
MFloatPoint operator* (const int scale) const
 The multipication operator that allows the vector to by scaled by the given parameter. More...
 
MFloatPoint operator* (const short scale) const
 The multipication operator that allows the vector to by scaled by the given parameter. More...
 
MFloatPoint operator* (const unsigned int scale) const
 The multipication operator that allows the vector to by scaled by the given parameter. More...
 
MFloatPoint operator* (const unsigned short scale) const
 The multipication operator that allows the vector to by scaled by the given parameter. More...
 
MFloatPoint operator* (const float scale) const
 The multipication operator that allows the vector to by scaled by the given float parameter. More...
 
MFloatPoint operator* (const double scale) const
 The multipication operator that allows the vector to by scaled by the given parameter. More...
 
MFloatPoint operator/ (const float scale) const
 The division operator that allows the vector to by scaled by the given float parameter. More...
 
MFloatPoint operator* (const MFloatMatrix &) const
 The multiplication operator for computing the product of this point instance with the given matrix. More...
 
MFloatPointoperator*= (const MFloatMatrix &)
 The in-place multiplication operator for computing the product of this point instance with the given matrix. More...
 
MFloatPointoperator*= (const int)
 The in-place multiplication operator for computing the scalar product of this point instance with the given scalar. More...
 
MFloatPointoperator*= (const short)
 The in-place multiplication operator for computing the scalar product of this point instance with the given scalar. More...
 
MFloatPointoperator*= (const unsigned int)
 The in-place multiplication operator for computing the scalar product of this point instance with the given scalar. More...
 
MFloatPointoperator*= (const unsigned short)
 The in-place multiplication operator for computing the scalar product of this point instance with the given scalar. More...
 
MFloatPointoperator*= (const float)
 The in-place multiplication operator for computing the scalar product of this point instance with the given scalar. More...
 
MFloatPointoperator*= (const double)
 The in-place multiplication operator for computing the scalar product of this point instance with the given scalar. More...
 
bool operator== (const MFloatPoint &other) const
 The equality operator. More...
 
bool operator!= (const MFloatPoint &other) const
 The inequality operator. More...
 
MFloatPointcartesianize ()
 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...
 
MFloatPointrationalize ()
 If this point instance is of the form P(W*x, W*y, W*z, W) (ie. More...
 
MFloatPointhomogenize ()
 If this point instance is of the form P(x, y, z, W) (ie. More...
 
float distanceTo (const MFloatPoint &other) const
 Return the distance between this instance and the point passed as an argument. More...
 
bool isEquivalent (const MFloatPoint &other, float tolerance=MFloatPoint_kTol) const
 Returns true if this instance the the point passed as an argument represent the same position within the specified tolerance. More...
 
float & operator() (unsigned int i)
 NO SCRIPT SUPPORT. More...
 
float & 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

float x
 the x component of the point
 
float y
 the y component of the point
 
float z
 the z component of the point
 
float w
 the w component of the point
 

Static Public Attributes

static const MFloatPoint origin
 A constant representing the origin - (0,0,0,1).
 

Friends

OPENMAYA_EXPORT MFloatPoint operator* (int, const MFloatPoint &)
 NO SCRIPT SUPPORT. More...
 
OPENMAYA_EXPORT MFloatPoint operator* (short, const MFloatPoint &)
 NO SCRIPT SUPPORT. More...
 
OPENMAYA_EXPORT MFloatPoint operator* (unsigned int, const MFloatPoint &)
 NO SCRIPT SUPPORT. More...
 
OPENMAYA_EXPORT MFloatPoint operator* (unsigned short, const MFloatPoint &)
 NO SCRIPT SUPPORT. More...
 
OPENMAYA_EXPORT MFloatPoint operator* (float, const MFloatPoint &)
 NO SCRIPT SUPPORT. More...
 
OPENMAYA_EXPORT MFloatPoint operator* (double, const MFloatPoint &)
 NO SCRIPT SUPPORT. More...
 
OPENMAYA_EXPORT MFloatPoint operator* (const MFloatMatrix &, const MFloatPoint &)
 NO SCRIPT SUPPORT. More...
 
OPENMAYA_EXPORT std::ostream & operator<< (std::ostream &os, const MFloatPoint &p)
 NO SCRIPT SUPPORT. More...
 

Constructor & Destructor Documentation

MFloatPoint ( )
inline

Default constructor.

The instance is initialized to the origin.

MFloatPoint ( const MFloatPoint srcpt)
inline

Copy constructor.

Creates an new instance and initializes it to the same point as the given point.

Parameters
[in]srcptthe point object to copy
MFloatPoint ( const MPoint srcpt)
inline

Copy constructor.

Creates an new instance and initializes it to the same point as the given point.

Warning
This method converts double precision floating point values to single precision. This will result in a loss of precision and, if the double precision value exceeds the valid range for single precision, the result will be undefined and unusable.
Parameters
[in]srcptthe point object to copy
MFloatPoint ( const MFloatVector srcpt)
inline

Create a new point and initialize it to the same x, y, z values as the given MFloatVector.

Parameters
[in]srcptthe vector object to copy
MFloatPoint ( const MVector srcpt)
inline

Create a new point and initialize it to the same x, y, z values as the given MVector.

Warning
This method converts double precision floating point values to single precision. This will result in a loss of precision and, if the double precision value exceeds the valid range for single precision, the result will be undefined and unusable.
Parameters
[in]srcptthe vector object to copy
MFloatPoint ( float  xx,
float  yy,
float  zz = 0.0,
float  ww = 1.0 
)
inline

Create a new instance and initialize it to the given position.

Parameters
[in]xxthe initial value of x
[in]yythe initial value of y
[in]zzthe initial value of z
[in]wwthe initial value of w
MFloatPoint ( const float  f[4])
inline

Create a new instance and initialize it to the given position.

Parameters
[in]fan array of 4 floats used to initialize x, y, z, and w respectively
MFloatPoint ( const double  d[4])
inline

Create a new instance and initialize it to the given position.

Warning
This method converts double precision floating point values to single precision. This will result in a loss of precision and, if the double precision value exceeds the valid range for single precision, the result will be undefined and unusable.
Parameters
[in]dan array of 4 doubles used to initialize x, y, z, and w respectively

Member Function Documentation

MStatus get ( double  dest[4]) const
inline

Copy the values of x, y, z, and w from the instance to the four elements of the given array of doubles.

Parameters
[out]destthe four element array of doubles
Returns
MS::kSuccess if dest is a non-zero pointer and MS::kFailure otherwise.
MStatus get ( float  dest[4]) const
inline

Copy the values of x, y, z, and w from the instance to the four elements of the given array of floats.

Parameters
[out]destthe four element array of floats
Returns
MS::kSuccess if dest is a non-zero pointer and MS::kFailure otherwise.
MStatus setCast ( const MPoint srcpt)
inline

Copy the values of x, y, z, and w from srcpt to the instance.

Warning
This method converts double precision floating point values to single precision. This will result in a loss of precision and, if the double precision value exceeds the valid range for single precision, the result will be undefined and unusable.
Parameters
[in]srcptthe point to copy the x, y, z and w values from.
Returns
MS::kSuccess always returned.
MStatus setCast ( const MVector src)
inline

Copy the values of x, y, z, and w from src to the instance.

Warning
This method converts double precision floating point values to single precision. This will result in a loss of precision and, if the double precision value exceeds the valid range for single precision, the result will be undefined and unusable.
Parameters
[in]srcthe vector to copy the x, y, z and w values from.
Returns
MS::kSuccess always returned.
MStatus setCast ( const double  d[4])
inline

Copy the values of x, y, z, and w to the instance from the four elements of the given array of doubles.

Warning
This method converts double precision floating point values to single precision. This will result in a loss of precision and, if the double precision value exceeds the valid range for single precision, the result will be undefined and unusable.
Parameters
[in]dthe four element array of doubles
Returns
MS::kSuccess if dest is a non-zero pointer and MS::kFailure otherwise
MFloatPoint & operator= ( const MFloatPoint src)
inline

The assignment operator.

Parameters
[in]srcThe point to copy from.
float operator() ( unsigned int  i) const
inline

The index operator.

  • If the argument is 0 it will return the x component of the constant instance.
  • If the argument is 1 it will return the y component of the constant instance.
  • If the argument is 2 it will return the z component of the constant instance.
  • If the argument is 3 it will return the w component of the constant instance. Otherwise it will return the x component of the point.
Parameters
[in]ivalue indicating which component to return
Returns
The value of the indicated component of the instance.
float operator[] ( unsigned int  i) const
inline

The index operator.

  • If the argument is 0 it will return the x component of the constant instance.
  • If the argument is 1 it will return the y component of the constant instance.
  • If the argument is 2 it will return the z component of the constant instance.
  • If the argument is 3 it will return the w component of the constant instance. Otherwise it will return the x component of the point.
Parameters
[in]ivalue indicating which component to return
Returns
The value of the indicated component of the instance.
MFloatVector operator- ( const MFloatPoint other) const
inline

The subtraction operator for two MFloatPoints.

The result is the MFloatVector from the other point to this instance.

Parameters
[in]otherThe point to substract.
Returns
MFloatVector from the other point to this point.
MFloatPoint operator+ ( const MFloatVector other) const
inline

The operator for adding an MFloatVector to an MFloatPoint.

A new point is returned whose position is that of the original point translated by the vector.

Parameters
[in]otherThe vector to add.
MFloatPoint operator- ( const MFloatVector other) const
inline

The operator for subtracting an MFloatVector from an MFloatPoint.

A new point is returned whose position is that of the original point translated by the inverse of the vector.

Parameters
[in]otherThe vector to substract.
MFloatPoint & operator+= ( const MFloatVector vector)
inline

The in-place addition operator for adding an MFloatVector to an MFloatPoint.

The current instance is translated from its original position by the vector.

Parameters
[in]vectorThe vector to add.
MFloatPoint & operator-= ( const MFloatVector vector)
inline

The in-place subtraction operator for subtracting an MFloatVector from an MFloatPoint.

The current instance is translated from its original position by the inverse of the vector.

Parameters
[in]vectorThe vector to substract.
MFloatPoint operator* ( const int  scale) const
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.

Parameters
[in]scaleThe scale parameter.
MFloatPoint operator* ( const short  scale) const
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.

Parameters
[in]scaleThe scale parameter.
MFloatPoint operator* ( const unsigned int  scale) const
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.

Parameters
[in]scaleThe scale parameter.
MFloatPoint operator* ( const unsigned short  scale) const
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.

Parameters
[in]scaleThe scale parameter.
MFloatPoint operator* ( const float  scale) const
inline

The multipication operator that allows the vector to by scaled by the given float parameter.

The x, y, and z components are each multiplied by the parameter. The w component remains unchanged.

Parameters
[in]scaleThe scale parameter.
MFloatPoint operator* ( const double  scale) const
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.

Parameters
[in]scaleThe scale parameter.
MFloatPoint operator/ ( const float  scale) const
inline

The division operator that allows the vector to by scaled by the given float parameter.

The x, y, and z components are each divided by the parameter. The w component remains unchanged.

Parameters
[in]scaleThe scale parameter.
Returns
Scaled point.
MFloatPoint operator* ( const MFloatMatrix right) const

The multiplication operator for computing the product of this point instance with the given matrix.

Parameters
[in]rightthe MFloatMatrix to right multiply by
Returns
A point representing the product
MFloatPoint & operator*= ( const MFloatMatrix right)

The in-place multiplication operator for computing the product of this point instance with the given matrix.

Parameters
[in]rightthe MFloatMatrix to right multiply by
Returns
A point representing the product
MFloatPoint & operator*= ( const int  factor)
inline

The in-place multiplication operator for computing the scalar product of this point instance with the given scalar.

Parameters
[in]factorScalar to multiply this point by.
Returns
This point.
MFloatPoint & operator*= ( const short  factor)
inline

The in-place multiplication operator for computing the scalar product of this point instance with the given scalar.

Parameters
[in]factorScalar to multiply this point by.
Returns
This point.
MFloatPoint & operator*= ( const unsigned int  factor)
inline

The in-place multiplication operator for computing the scalar product of this point instance with the given scalar.

Parameters
[in]factorScalar to multiply this point by.
Returns
This point.
MFloatPoint & operator*= ( const unsigned short  factor)
inline

The in-place multiplication operator for computing the scalar product of this point instance with the given scalar.

Parameters
[in]factorScalar to multiply this point by.
Returns
This point.
MFloatPoint & operator*= ( const float  factor)
inline

The in-place multiplication operator for computing the scalar product of this point instance with the given scalar.

Parameters
[in]factorScalar to multiply this point by.
Returns
This point.
MFloatPoint & operator*= ( const double  factor)
inline

The in-place multiplication operator for computing the scalar product of this point instance with the given scalar.

Parameters
[in]factorScalar to multiply this point by.
Returns
This point.
bool operator== ( const MFloatPoint other) const
inline

The equality operator.

Returns true if all of the x, y, z, and w components of the two points are identical.

Parameters
[in]otherThe point to compare with.
bool operator!= ( const MFloatPoint other) const
inline

The inequality operator.

Returns true if any of the x, y, z, and w components of the two points are not identical.

Parameters
[in]otherThe point to compare with.
MFloatPoint & 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.

MFloatPoint & 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.

MFloatPoint & 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).

float distanceTo ( const MFloatPoint other) const
inline

Return the distance between this instance and the point passed as an argument.

Parameters
[in]otherthe point to compute the distance to
Returns
The distance between the two points.
bool isEquivalent ( const MFloatPoint other,
float  tol = MFloatPoint_kTol 
) const
inline

Returns true if this instance the the point passed as an argument represent the same position within the specified tolerance.

Parameters
[in]otherthe other point to compare to
[in]tolthe tolerance to use during the comparison
Returns
True if the points are equal within the given tolerance and false otherwise.
float & operator() ( unsigned int  i)
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.
Parameters
[in]ivalue indicating which component to return
Returns
The value of the indicated component of the instance.
float & operator[] ( unsigned int  i)
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.
Parameters
[in]ivalue indicating which component to return
Returns
The value of the indicated component of the instance.
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

Friends And Related Function Documentation

OPENMAYA_EXPORT MFloatPoint operator* ( int  scale,
const MFloatPoint p 
)
friend

NO SCRIPT SUPPORT.

The point's x, y, and z components are each multiplied by the scalar. The w component remains unchanged.

Parameters
[in]scaleThe scale parameter.
[in]pThe point to be scaled.
Returns
A new point containing the value of 'p' scaled by 'scale'.
OPENMAYA_EXPORT MFloatPoint operator* ( short  scale,
const MFloatPoint p 
)
friend

NO SCRIPT SUPPORT.

The point's x, y, and z components are each multiplied by the scalar. The w component remains unchanged.

Parameters
[in]scaleThe scale parameter.
[in]pThe point to be scaled.
Returns
A new point containing the value of 'p' scaled by 'scale'.
OPENMAYA_EXPORT MFloatPoint operator* ( unsigned int  scale,
const MFloatPoint p 
)
friend

NO SCRIPT SUPPORT.

The point's x, y, and z components are each multiplied by the scalar. The w component remains unchanged.

Parameters
[in]scaleThe scale parameter.
[in]pThe point to be scaled.
Returns
A new point containing the value of 'p' scaled by 'scale'.
OPENMAYA_EXPORT MFloatPoint operator* ( unsigned short  scale,
const MFloatPoint p 
)
friend

NO SCRIPT SUPPORT.

The point's x, y, and z components are each multiplied by the scalar. The w component remains unchanged.

Parameters
[in]scaleThe scale parameter.
[in]pThe point to be scaled.
Returns
A new point containing the value of 'p' scaled by 'scale'.
OPENMAYA_EXPORT MFloatPoint operator* ( float  scale,
const MFloatPoint p 
)
friend

NO SCRIPT SUPPORT.

The point's x, y, and z components are each multiplied by the scalar. The w component remains unchanged.

Parameters
[in]scaleThe scale parameter.
[in]pThe point to be scaled.
Returns
A new point containing the value of 'p' scaled by 'scale'.
OPENMAYA_EXPORT MFloatPoint operator* ( double  scale,
const MFloatPoint p 
)
friend

NO SCRIPT SUPPORT.

The point's x, y, and z components are each multiplied by the scalar. The w component remains unchanged.

Parameters
[in]scaleThe scale parameter.
[in]pThe point to be scaled.
Returns
A new point containing the value of 'p' scaled by 'scale'.
OPENMAYA_EXPORT MFloatPoint operator* ( const MFloatMatrix left,
const MFloatPoint right 
)
friend

NO SCRIPT SUPPORT.

Parameters
[in]leftthe MFloatMatrix to right multiply by
[in]rightthis point instance
Returns
A point representing the product
OPENMAYA_EXPORT std::ostream& operator<< ( std::ostream &  os,
const MFloatPoint p 
)
friend

NO SCRIPT SUPPORT.

The format used is [x, y, z, w].

Parameters
[in]osthe ostream to print to
[in]pthe MFloatPoint whose value is to be printed
Returns
The ostream reference, s, provided as the first parameter.

The documentation for this class was generated from the following files:
  • MFloatPoint.h
  • MFloatPoint.cpp