class MFloatVector

Jump to documentation

A vector math class for vectors of floats. (OpenMaya) (OpenMaya.py)

public members:

MFloatVector ()
MFloatVector ( const MFloatPoint &)
MFloatVector ( const MFloatVector &)
MFloatVector ( const MVector &)
MFloatVector ( const MPoint &)
MFloatVector ( float xx, float yy, float zz = 0.0)
MFloatVector ( const float[3] )
~MFloatVector ()
MFloatVector & operator= ( const MFloatVector & src )
float operator() ( unsigned int i ) const
float operator[] ( unsigned int i )const
MFloatVector operator^ ( const MFloatVector & right) const
MFloatVector & operator/= ( float scalar )
MFloatVector operator/ ( float scalar ) const
MFloatVector & operator*= ( float scalar )
MFloatVector operator* ( float scalar ) const
MFloatVector operator+ ( const MFloatVector & other) const
MFloatVector & operator+= ( const MFloatVector & other )
MFloatVector operator- () const
MFloatVector operator- ( const MFloatVector & other ) const
MFloatVector & operator-= ( const MFloatVector & other )
MFloatVector operator* ( const MFloatMatrix &) const
MFloatVector & operator*= ( const MFloatMatrix &)
float operator* ( const MFloatVector & other ) const
bool operator!= ( const MFloatVector & other ) const
bool operator== ( const MFloatVector & other ) const
MStatus get ( float[3] ) const
float length () const
MFloatVector normal () const
MStatus normalize ()
float angle ( const MFloatVector & other ) const
bool isEquivalent ( const MFloatVector & other, float tolerance = MFloatVector_kTol ) const
bool isParallel ( const MFloatVector & other, float tolerance = MFloatVector_kTol ) const
float& operator() ( unsigned int i )
NO SCRIPT SUPPORT
float& operator[] ( unsigned int i )
NO SCRIPT SUPPORT
MFloatVector transformAsNormal ( const MFloatMatrix & matrix ) const
NO SCRIPT SUPPORT
friend MFloatVector operator* ( int, const MFloatVector & )
NO SCRIPT SUPPORT
friend MFloatVector operator* ( short, const MFloatVector & )
NO SCRIPT SUPPORT
friend MFloatVector operator* ( unsigned int, const MFloatVector & )
NO SCRIPT SUPPORT
friend MFloatVector operator* ( unsigned short, const MFloatVector & )
NO SCRIPT SUPPORT
friend MFloatVector operator* ( float, const MFloatVector & )
NO SCRIPT SUPPORT
friend MFloatVector operator* ( double, const MFloatVector & )
NO SCRIPT SUPPORT
friend MFloatVector operator* ( const MFloatMatrix &, const MFloatVector & )
NO SCRIPT SUPPORT
friend std::ostream& operator<< ( std::ostream& os, const MFloatVector & v )
NO SCRIPT SUPPORT
static const MFloatVector zero
The null vector
static const MFloatVector one
The vector <1.0,1.0,1.0>
static const MFloatVector xAxis
Unit vector in the positive x direction
static const MFloatVector yAxis
Unit vector in the positive y direction
static const MFloatVector zAxis
Unit vector in the positive z direction
static const MFloatVector xNegAxis
Unit vector in the negative z direction
static const MFloatVector yNegAxis
Unit vector in the negative z direction
static const MFloatVector zNegAxis
Unit vector in the negative z direction
float x
The x component of the vector
float y
The y component of the vector
float z
The z component of the vector

Documentation

This class provides access to Maya's vector math library.
Description

This class provides access to Maya's internal vector math library allowing vectors to be handled easily, and in a manner compatible with internal Maya data structures.

Functions

MFloatVector:: MFloatVector ()

Description

The default class constructor. Creates a null vector.

MFloatVector:: MFloatVector (const MFloatPoint & src)

Description

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

Arguments

  • src the vector object to copy

MFloatVector:: MFloatVector (const MFloatVector & src)

Description

The copy constructor. Create a new vector and initialize it to the same values as the given vector.

Arguments

  • src the vector object to copy

MFloatVector:: MFloatVector (const MVector & src)

Description

Class constructor. Create a new vector and initialize it to the same values as the given vector.

Arguments

  • src the vector object to copy

MFloatVector:: MFloatVector (const MPoint & src)

Description

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

Arguments

  • src the point object to copy

MFloatVector:: MFloatVector (float xx, float yy, float zz)

Description

Class constructor. Initializes the vector with the explicit x, y and z values provided as arguments.

Arguments

  • xx the x component of the vector
  • yy the y component of the vector
  • zz the z component of the vector. Defaults to 0.0.

MFloatVector:: MFloatVector ( const float d[3] )

Description

Class constructor. Initializes the vector with the explicit x, y and z values provided in the given float array.

Arguments

  • d the 3 element array containing the initial x, y, and z values

MFloatVector:: ~MFloatVector ()

Description

Class destructor.

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

Description

The assignment operator. Allows assignment between MFloatVectors.

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

Description

The index operator. If its argument is 0 it will return the x component of the vector. If its argument is 1 it will return the y component of the vector. Otherwise it will return the z component of the vector.

Arguments

  • i value indicating which component to return

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

Description

The index operator. If its argument is 0 it will return the x component of the vector. If its argument is 1 it will return the y component of the vector. Otherwise it will return the z component of the vector.

Arguments

  • i value indicating which component to return

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

Description

The index operator. If its argument is 0 it will return the x component of the vector. If its argument is 1 it will return the y component of the vector. Otherwise it will return the z component of the vector.

Arguments

  • i value indicating which component to return

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

Description

The index operator. If its argument is 0 it will return the x component of the vector. If its argument is 1 it will return the y component of the vector. Otherwise it will return the z component of the vector.

Arguments

  • i value indicating which component to return

MFloatVector MFloatVector:: operator^ (const MFloatVector & right) const

Description

The cross product operator.

MFloatVector & MFloatVector:: operator*= (float scalar)

Description

The in place multiplication operator.

MFloatVector MFloatVector:: operator* ( float scalar ) const

Description

The multiplication operator.

MFloatVector operator * (int scalar, const MFloatVector & other)

Description

The multiplication operator that allows the scalar value to preceed the vector.

MFloatVector operator * (short scalar, const MFloatVector & other)

Description

The multiplication operator that allows the scalar value to preceed the vector.

MFloatVector operator * (unsigned int scalar, const MFloatVector & other)

Description

The multiplication operator that allows the scalar value to preceed the vector.

MFloatVector operator * (unsigned short scalar, const MFloatVector & other)

Description

The multiplication operator that allows the scalar value to preceed the vector.

MFloatVector operator * (float scalar, const MFloatVector & other)

Description

The multiplication operator that allows the scalar value to preceed the vector.

MFloatVector operator * (double scalar, const MFloatVector & other)

Description

The multiplication operator that allows the scalar value to preceed the vector.

MFloatVector & MFloatVector:: operator/= (float scalar)

Description

The in place division operator.

MFloatVector MFloatVector:: operator/ ( float scalar ) const

Description

The division operator.

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

Description

The vector subtraction operator.

MFloatVector MFloatVector:: operator+ (const MFloatVector & other) const

Description

The vector addition operator.

MFloatVector & MFloatVector:: operator+= (const MFloatVector & other)

Description

The in place vector addition operator.

MFloatVector MFloatVector:: operator- () const

Description

The unary minus operator. Negates the value of each of the x, y, and z components of the vector.

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

Description

The in place vector subtraction operator.

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

Description

The matrix multiplication operator.

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

Description

The in place matrix multiplication operator.

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

Description

The multiplication operator that allows 2 matrices to be multiplied producing an MFloatVector.

Arguments

  • left the matrix on the left
  • right the matrix on the right

Return Value

  • the MFloatVector resulting from the multiplication

float MFloatVector:: operator* (const MFloatVector & other) const

Description

The vector multiplication operator.

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

Description

The vector equality operator. This returns true if all three of the x, y, and z components are identical.

Return Value

  • bool true if the vectors are identical and false otherwise

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

Description

The vector inequality operator. This returns false if all three of the x, y, and z components are identical.

Return Value

  • bool false if the vectors are identical and true otherwise

MStatus MFloatVector:: get ( float d[3] ) const

Description

Extracts the x, y, and z components of the vector and places them in elements 0, 1, and 2 of the float array passed.

Arguments

  • d the array of 3 floats into which the results are placed.

Return Value

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

float MFloatVector:: length () const

Description

Return the length of the vector.

MFloatVector MFloatVector:: normal () const

Description

Return a unit vector that is normal to the vector.

MStatus MFloatVector:: normalize ()

Description

Performs an in place normalization of the vector

Return Value

  • always returns MS::kSuccess

float MFloatVector:: angle (const MFloatVector & other) const

Description

Returns the angle in radians between the vector and the one passed as an argument.

Arguments

  • other the vector from which to compute the angle.

Return Value

  • the angle in radians

bool MFloatVector:: isEquivalent (const MFloatVector & other, float tol) const

Description

Returns true if the vector and the one passed as an argument are equal to each other within the specified tolerance.

Arguments

  • other the vector to compare to
  • tol the tolerance to use during the comparison

Return Value

  • bool true if the vectors are equivalent and false otherwise

bool MFloatVector:: isParallel (const MFloatVector & other, float tol) const

Description

Returns true if the current vector and the one passed as an argument are parallel to each other within the specified tolerance.

Arguments

  • other the vector to compare to
  • tol the tolerance to use during the comparison

Return Value

  • bool true if the vectors are parallel and false otherwise

MFloatVector MFloatVector:: transformAsNormal ( const MFloatMatrix & matrix ) const

Description

This method treats the vector as a normal vector and returns a transformed copy of the vector.

Normal vectors are not transformed in the same way as position vectors or points. If this vector is treated as a normal vector then it needs to be transformed by post multiplying it by the inverse tanspose of the transformation matrix. This method will apply the proper transformation to the vector as if it were a normal.

Arguments

  • matrix the transformation matrix

Return Value

  • The resulting transformed vector

std::ostream& operator<< ( std::ostream& os, const MFloatVector & v )

Description

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

Arguments

  • s the ostream to print to
  • str the MFloatVector 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