MFloatVector Class Reference
[OpenMaya - API module for common classes]

#include <MFloatVector.h>
Collaboration diagram for MFloatVector:
Collaboration graph
[legend]

List of all members.


Detailed Description

A vector math class for vectors of floats.

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.

All methods that query the vector are threadsafe, all methods that modify the vector are not threadsafe.

Examples:

anisotropicShader.cpp, backfillShader.cpp, blindDataShader.cpp, brickShader.cpp, cellShader.cpp, cgfxShaderNode.cpp, checkerShader.cpp, clearcoat.cpp, compositingShader.cpp, contrastShader.cpp, cvColorShader.cpp, depthShader.cpp, displacementShader.cpp, dynExprField.cpp, flameShader.cpp, gammaShader.cpp, geomShader.cpp, GLSLShaderNode.cpp, hwColorPerVertexShader.cpp, hwDecalBumpShader_NV20.cpp, hwPhongShader.cpp, hwPhongShader.h, hwReflectBumpShader_NV20.cpp, hwRefractReflectShader_NV20.cpp, hwToonShader_NV20.cpp, hwUnlitShader.cpp, interpShader.cpp, intersectCmd.cpp, lambertShader.cpp, lavaShader.cpp, lightShader.cpp, meshOpFtyAction.cpp, mixtureShader.cpp, noiseShader.cpp, objExport.cpp, phongShader.cpp, polyModifierCmd.cpp, polyModifierCmd.h, sampleCmd.cpp, sampleParticles.cpp, shadowMatteShader.cpp, shiftNode.cpp, slopeShaderNode.cpp, solidCheckerShader.cpp, and volumeShader.cpp.


Public Member Functions

  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 d[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=1.0e-5F) const
bool  isParallel (const MFloatVector &other, float tolerance=1.0e-5F) 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.

Public Attributes

float  x
  The x component of the vector.
float  y
  The y component of the vector.
float  z
  The z component of the vector.

Static Public Attributes

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.

Friends

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

Constructor & Destructor Documentation

MFloatVector::MFloatVector (  )  [inline]

The default class constructor. Creates a null vector.

MFloatVector::MFloatVector ( const MFloatPoint src  ) 

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

Parameters:
[in]  src  the vector object to copy

MFloatVector::MFloatVector ( const MFloatVector src  )  [inline]

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

Parameters:
[in]  src  the vector object to copy

MFloatVector::MFloatVector ( const MVector src  ) 

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

Parameters:
[in]  src  the vector object to copy

MFloatVector::MFloatVector ( const MPoint src  ) 

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

Parameters:
[in]  src  the point object to copy

MFloatVector::MFloatVector ( float  xx,
float  yy,
float  zz = 0.0  
) [inline]

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

Parameters:
[in]  xx  the x component of the vector
[in]  yy  the y component of the vector
[in]  zz  the z component of the vector. Defaults to 0.0.

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

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

Parameters:
[in]  d  the 3 element array containing the initial x, y, and z values.

MFloatVector::~MFloatVector (  )  [inline]

Class destructor.


Member Function Documentation

MFloatVector & MFloatVector::operator= ( const MFloatVector src  )  [inline]

The assignment operator. Allows assignment between MFloatVectors.

Parameters:
[in]  src  The vector to copy from.
Returns:
A reference to the assigned vector.

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

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.

Parameters:
[in]  i  Value indicating which component to return.
Returns:
The vector component.

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

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.

Parameters:
[in]  i  Value indicating which component to return.
Returns:
The vector component.

MFloatVector MFloatVector::operator^ ( const MFloatVector right  )  const [inline]

The cross product operator.

Parameters:
[in]  right  Vector to take the cross product with.
Returns:
The cross product result.

MFloatVector & MFloatVector::operator/= ( float  scalar  )  [inline]

The in place division operator.

Parameters:
[in]  scalar  Division factor.
Returns:
A reference to the scaled vector.

MFloatVector MFloatVector::operator/ ( float  scalar  )  const [inline]

The division operator.

Parameters:
[in]  scalar  Division factor.
Returns:
The scaled vector.

MFloatVector & MFloatVector::operator*= ( float  scalar  )  [inline]

The in place multiplication operator.

Parameters:
[in]  scalar  Scale factor.
Returns:
A reference to the scaled vector.

MFloatVector MFloatVector::operator* ( float  scalar  )  const [inline]

The multiplication operator.

Parameters:
[in]  scalar  Scale factor.
Returns:
The scaled vector.

MFloatVector MFloatVector::operator+ ( const MFloatVector other  )  const [inline]

The vector addition operator.

Parameters:
[in]  other  Vector to add.
Returns:
The resulting vector.

MFloatVector & MFloatVector::operator+= ( const MFloatVector other  )  [inline]

The in place vector addition operator.

Parameters:
[in]  other  Vector to add.
Returns:
A reference to the resulting vector.

MFloatVector MFloatVector::operator- (  )  const [inline]

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

Returns:
The resulting vector.

MFloatVector MFloatVector::operator- ( const MFloatVector other  )  const [inline]

The vector subtraction operator.

Parameters:
[in]  other  Vector to substract.
Returns:
The resulting vector.

MFloatVector & MFloatVector::operator-= ( const MFloatVector other  )  [inline]

The in place vector subtraction operator.

Parameters:
[in]  other  Vector to substract.
Returns:
A reference to the resulting vector.

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

The matrix multiplication operator.

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

The in place matrix multiplication operator.

float MFloatVector::operator* ( const MFloatVector right  )  const [inline]

The dot product operator.

Parameters:
[in]  right  Vector take the dot product with.
Returns:
Dot product value.

bool MFloatVector::operator!= ( const MFloatVector other  )  const [inline]

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

Parameters:
[in]  other  Vector to compare against.
Returns:
Bool false if the vectors are identical and true otherwise.

bool MFloatVector::operator== ( const MFloatVector other  )  const [inline]

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

Parameters:
[in]  other  Vector to compare against.
Returns:
Bool true if the vectors are identical and false otherwise.

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

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

Parameters:
[out]  d  The array of 3 floats into which the results are placed.
Returns:
MS::kSuccess if d is a non-zero pointer and MS::kFailure otherwise.

float MFloatVector::length (  )  const [inline]
Returns:
The length of the vector.

MFloatVector MFloatVector::normal (  )  const [inline]

Computes a unit vector aligned to the vector.

Returns:
The unit vector.
Examples:

MStatus MFloatVector::normalize (  )  [inline]

Performs an in place normalization of the vector

Returns:
Always returns MS::kSuccess.
Examples:

float MFloatVector::angle ( const MFloatVector other  )  const

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

Parameters:
[in]  other  the vector from which to compute the angle.
Returns:
The angle in radians

bool MFloatVector::isEquivalent ( const MFloatVector other,
float  tol = 1.0e-5F  
) const

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

Parameters:
[in]  other  the vector to compare to
[in]  tol  the tolerance to use during the comparison
Returns:
true if the vectors are equivalent and false otherwise

bool MFloatVector::isParallel ( const MFloatVector other,
float  tol = 1.0e-5F  
) const

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

Parameters:
[in]  other  the vector to compare to
[in]  tol  the tolerance to use during the comparison
Returns:
true if the vectors are parallel and false otherwise

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

NO SCRIPT SUPPORT.

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.

Parameters:
[in]  i  Value indicating which component to return.
Returns:
Reference to the vector component.

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

NO SCRIPT SUPPORT.

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.

Parameters:
[in]  i  Value indicating which component to return.
Returns:
Reference to the vector component.

MFloatVector MFloatVector::transformAsNormal ( const MFloatMatrix matrix  )  const

NO SCRIPT SUPPORT.

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.

Parameters:
[in]  matrix  the transformation matrix
Returns:
The resulting transformed vector

Friends And Related Function Documentation

OPENMAYA_EXPORT MFloatVector operator* ( int  scalar,
const MFloatVector other  
) [friend]

NO SCRIPT SUPPORT.

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

Parameters:
[in]  scalar  multiplication factor.
[in]  other  Vector to scale.
Returns:
Scaled vector.

OPENMAYA_EXPORT MFloatVector operator* ( short  scalar,
const MFloatVector other  
) [friend]

NO SCRIPT SUPPORT.

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

Parameters:
[in]  scalar  multiplication factor.
[in]  other  Vector to scale.
Returns:
Scaled vector.

OPENMAYA_EXPORT MFloatVector operator* ( unsigned int  scalar,
const MFloatVector other  
) [friend]

NO SCRIPT SUPPORT.

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

Parameters:
[in]  scalar  multiplication factor.
[in]  other  Vector to scale.
Returns:
Scaled vector.

OPENMAYA_EXPORT MFloatVector operator* ( unsigned short  scalar,
const MFloatVector other  
) [friend]

NO SCRIPT SUPPORT.

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

Parameters:
[in]  scalar  multiplication factor.
[in]  other  Vector to scale.
Returns:
Scaled vector.

OPENMAYA_EXPORT MFloatVector operator* ( float  scalar,
const MFloatVector other  
) [friend]

NO SCRIPT SUPPORT.

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

Parameters:
[in]  scalar  multiplication factor.
[in]  other  Vector to scale.
Returns:
Scaled vector.

OPENMAYA_EXPORT MFloatVector operator* ( double  scalar,
const MFloatVector other  
) [friend]

NO SCRIPT SUPPORT.

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

Parameters:
[in]  scalar  multiplication factor.
[in]  other  Vector to scale.
Returns:
Scaled vector.

OPENMAYA_EXPORT MFloatVector operator* ( const MFloatMatrix left,
const MFloatVector right  
) [friend]

NO SCRIPT SUPPORT.

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

Parameters:
[in]  left  the matrix on the left
[in]  right  the matrix on the right
Returns:
The MFloatVector resulting from the multiplication

OPENMAYA_EXPORT std::ostream& operator<< ( std::ostream &  os,
const MFloatVector v  
) [friend]

NO SCRIPT SUPPORT.

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

Parameters:
[in]  os  the ostream to print to
[in]  v  the MFloatVector whose value is to be printed
Returns:
The ostream reference, s, provided as the first parameter.

Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6