class MFloatPoint

Jump to documentation

Implementation of a point. (OpenMaya) (OpenMaya.py)

public members:

MFloatPoint ()
MFloatPoint ( const MFloatPoint & srcpt )
MFloatPoint ( const MFloatVector & src )
MFloatPoint ( float xx, float yy, float zz = 0.0, float ww = 1.0 )
MFloatPoint ( const float[4] )
~MFloatPoint ()
MStatus get ( double[4] ) const
MStatus get ( float[4] ) const
MStatus setCast ( const MPoint & srcpt )
MStatus setCast ( const MVector & src )
MStatus setCast ( const double[4] )
MFloatPoint & operator= ( const MFloatPoint & src )
float operator() (unsigned int i) const
float operator[] (unsigned int i) const
MFloatVector operator- ( const MFloatPoint & other ) const
MFloatPoint operator+ ( const MFloatVector & other ) const
MFloatPoint operator- ( const MFloatVector & other ) const
MFloatPoint & operator+= ( const MFloatVector & vector )
MFloatPoint & operator-= ( const MFloatVector & vector )
MFloatPoint operator* (const float scale) const
MFloatPoint operator/ (const float scale) const
MFloatPoint operator* (const MFloatMatrix &) const
MFloatPoint & operator*= (const MFloatMatrix &)
bool operator== ( const MFloatPoint & other ) const
bool operator!= ( const MFloatPoint & other ) const
MFloatPoint & cartesianize ()
MFloatPoint & rationalize ()
MFloatPoint & homogenize ()
float distanceTo ( const MFloatPoint & other ) const
bool isEquivalent ( const MFloatPoint & other, float tolerance = MFloatPoint_kTol) const
float & operator() (unsigned int i)
NO SCRIPT SUPPORT
float & operator[] (unsigned int i)
NO SCRIPT SUPPORT
friend MFloatPoint operator* ( const MFloatMatrix &, const MFloatPoint & )
NO SCRIPT SUPPORT
friend std::ostream& operator<< ( std::ostream& os, const MFloatPoint & p )
NO SCRIPT SUPPORT
static const MFloatPoint origin
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

Documentation

This class implements the Maya representation of a point in floats
Description

This class provides an implementation of a point in float. Numerous convienence operators are provided to help with the manipulation of points. This includes operators that work with the MFloatVector and MFloatMatrix classes.

Functions

const MFloatPoint MFloatPoint:: origin (0,0,0,1)

Description

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

MFloatPoint:: MFloatPoint ()

Description

Default constructor. The instance is initialized to the origin.

MFloatPoint:: MFloatPoint (const MFloatPoint & srcpt)

Description

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

Arguments

  • srcpt the point object to copy

MFloatPoint:: MFloatPoint (const MFloatVector & srcpt)

Description

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

Arguments

  • srcpt the vector object to copy

MFloatPoint:: MFloatPoint (const float d[4] )

Description

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

Arguments

  • d an array of 4 floats used to initialize x, y, z, and w respectively

MFloatPoint:: MFloatPoint (float xx, float yy, float zz, float ww)

Description

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

Arguments

  • xx the initial value of x
  • yy the initial value of y
  • zz the initial value of z
  • ww the initial value of w

MFloatPoint:: ~MFloatPoint ()

Description

Class destructor.

MStatus MFloatPoint:: get ( double dest[4] ) const

Description

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

Arguments

  • dest the four element array of doubles

Return Value

  • MS::kSuccess if dest is a non-zero pointer and MS::kFailure otherwise

MStatus MFloatPoint:: get ( float dest[4] ) const

Description

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

Arguments

  • dest the four element array of floats

Return Value

  • MS::kSuccess if dest is a non-zero pointer and MS::kFailure otherwise

MStatus MFloatPoint:: setCast (const MPoint & srcpt)

Description

Copy the values of x, y, z, and w from srcpt to the instance. Note that this operation will lose precision as it casts from double to single-precision floating point.

Arguments

  • srcpt the point to copy the x, y, z and w values from.

Return Value

  • MS::kSuccess always returned.

MStatus MFloatPoint:: setCast ( const MVector & src )

Description

Copy the values of x, y, z, and w from src to the instance. Note that this operation will lose precision as it casts from double to single-precision floating point.

Arguments

  • src the vector to copy the x, y, z and w values from.

Return Value

  • MS::kSuccess always returned.

MStatus MFloatPoint:: setCast ( const double d[4] )

Description

Copy the values of x, y, z, and w to the instance from the four elements of the given array of doubles. Note that this operation will lose precision as it casts from double to single-precision floating point.

Arguments

  • d the four element array of doubles

Return Value

  • MS::kSuccess if dest is a non-zero pointer and MS::kFailure otherwise

MFloatPoint & MFloatPoint:: operator= (const MFloatPoint & src)

Description

The assignment operator.

float& MFloatPoint:: operator() (unsigned int i)

Description

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.

Arguments

  • i value indicating which component to return

Return Value

  • the value of the indicated component of the instance

float MFloatPoint:: operator() (unsigned int i) const

Description

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.

Arguments

  • i value indicating which component to return

Return Value

  • the value of the indicated component of the instance

float& MFloatPoint:: operator[] ( unsigned int i )

Description

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.

Arguments

  • i value indicating which component to return

Return Value

  • the value of the indicated component of the instance

float MFloatPoint:: operator[] ( unsigned int i ) const

Description

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.

Arguments

  • i value indicating which component to return

Return Value

  • the value of the indicated component of the instance

MFloatPoint MFloatPoint:: operator+ (const MFloatVector & vector) const

Description

The addition 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.

MFloatPoint MFloatPoint:: operator- (const MFloatVector & vector) const

Description

The addition 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.

MFloatVector MFloatPoint:: operator- (const MFloatPoint & other) const

Description

The subtraction operator for two MFloatPoints. The result is the MFloatVector from the other point to this instance.

Arguments

  • other the other point

Return Value

  • MFloatVector from the other point to this point

MFloatPoint & MFloatPoint:: operator+= (const MFloatVector & vector )

Description

The in-place addition operator for adding an MFloatVector to an MFloatPoint. The current instance is translated from its original position by the vector.

MFloatPoint & MFloatPoint:: operator-= (const MFloatVector & vector)

Description

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.

MFloatPoint MFloatPoint:: operator* (const MFloatMatrix & right) const

Description

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

Arguments

  • right the MFloatMatrix to right multiply by

Return Value

  • a point representing the product

MFloatPoint & MFloatPoint:: operator*= (const MFloatMatrix & right)

Description

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

Arguments

  • right the MFloatMatrix to right multiply by

Return Value

  • a point representing the product

MFloatPoint operator* (const MFloatMatrix & left, const MFloatPoint & right)

Description

The multiplication operator for computing the product of this point instance with the given matrix that allows the matrix to be on the left side of the operator.

Arguments

  • left the MFloatMatrix to right multiply by
  • right this point instance

Return Value

  • a point representing the product

MFloatPoint MFloatPoint:: operator* (const float scale) const

Description

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.

Arguments

  • scale the scale parameter

MFloatPoint MFloatPoint:: operator/ (const float scale) const

Description

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.

Arguments

  • scale the scale parameter

Return Value

  • var des

bool MFloatPoint:: operator== (const MFloatPoint & other) const

Description

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

bool MFloatPoint:: operator!= (const MFloatPoint & other) const

Description

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

MFloatPoint & MFloatPoint:: cartesianize ()

Description

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 & MFloatPoint:: rationalize ()

Description

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 & MFloatPoint:: homogenize ()

Description

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

bool MFloatPoint:: isEquivalent (const MFloatPoint & other, float tolerance) const

Description

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

Arguments

  • other the other point to compare to
  • tolerance the tolerance to use during the comparison

Return Value

  • true if the points are equal within the given tolerance and false otherwise

float MFloatPoint:: distanceTo (const MFloatPoint & other) const

Description

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

Arguments

  • other the point to compute the distance to

Return Value

  • the distance between the two points

std::ostream& operator<< ( std::ostream& os, const MFloatPoint & p )

Description

Print the contents of the given MFloatPoint on the given ostream. The format used is [x, y, z, w].

Arguments

  • s the ostream to print to
  • str the MFloatPoint whose value is to be printed

Return Value

  • the ostream reference, s, provided as the first parameter.

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright