MFloatVector

Constants

NameTypeDescription
kTolerance float Default tolerance used for inexact comparisons.
Common Vectors
kZeroVector MFloatVector (0,0,0)
kOneVector MFloatVector (1,1,1)
kXaxisVector MFloatVector (1,0,0)
kYaxisVector MFloatVector (0,1,0)
kZaxisVector MFloatVector (0,0,1)
kXnegAxisVector MFloatVector (-1,0,0)
kYnegAxisVector MFloatVector (0,-1,0)
kZnegAxisVector MFloatVector (0,0,-1)

Static Methods

None.

Static Attributes

None.

Constructors

SignatureParametersDescription
MFloatVector()   Default constructor. Returns a new MFloatVector object initialized to the zero vector.
MFloatVector(src) src - MVector, MFloatVector, MPoint or MFloatPoint Copy constructor. Returns a new MFloatVector object whose x, y and z coordinates are set to the x, y and z coordinates of src.
MFloatVector(seq) seq - sequence of two three floats Returns a new MFloatVector object whose x, y and z coordinates are set to the elements of seq. If the sequence only contains two values, z will be set to 0.0.
MFloatVector(x, y, z=0.0) x - float
y - float
z - float
Returns a new MFloatVector object with the specified x, y and z coordinates.

Object Methods

SignatureParametersReturnsDescription
length()   float Returns the magnitude of this vector.
normal()   MFloatVector Returns a new vector containing the normalized version of this vector.
normalize()   Reference to self Normalizes this vector in-place and returns a new reference to it.
transformAsNormal(matrix) matrix - MFloatMatrix MFloatVector Returns a new vector which is calculated by postmultiplying this vector by the transpose of matrix and then normalizing it.
angle(other) other - MFloatVector float Returns the angle, in radians, between this vector and other.
isEquivalent(other, tolerance=kTolerance) other - MFloatVector
tolerance - float
bool Returns True if this vector and other are within the given tolerance of being equal.
isParallel(other, tolerance=kTolerance) other - MFloatVector
tolerance - float
bool Returns True if this vector and other are within the given tolerance of being parallel.

Object Attributes

NameTypeAccessDescription
x float RW X component.
y float RW Y component.
z float RW Z component.

Sequence Support

An MFloatVector is treated a sequence of three float values: [x, y, z].

len() returns 3.

Indexing and element assignment are supported.

Deletion, concatenation, repetition and slicing are not supported.

Number Support

OperationDescription
MFloatVector = MFloatVector ^ MFloatVector Cross product of two vectors.
float = MFloatVector * MFloatVector Dot product of the two vectors.
MFloatVector = MFloatVector / scalar Returns a new vector whose components are those of the given vector, each divided by scalar, which can be of any type which is convertable to float.
MFloatVector /= scalar Divides each component of the vector by scalar, which can be of any type which is convertable to float, and returns a new reference to the vector.
MFloatVector = MFloatVector * scalar Returns a new vector whose components are those of the given vector, each multiplied by scalar, which can be of any type which is convertable to float.
MFloatVector = scalar * MFloatVector Returns a new vector whose components are those of the given vector, each multiplied by scalar, which can be of any type which is convertable to float.
MFloatVector *= scalar Multiplies each component of the vector by scalar, which can be of any type which is convertable to float, and returns a new reference to the vector.
MFloatVector = MFloatVector * MFloatMatrix Postmultiplying a vector by a matrix.
MFloatVector = MFloatMatrix * MFloatVector Premultiplying a vector by a matrix.
MFloatVector *= MFloatMatrix Postmultiplies the vector by the matrix and returns a new reference to the vector.
MFloatVector = MFloatVector + MFloatVector Vector addition.
MFloatVector += MFloatVector In-pace vector addition.
MFloatVector = -MFloatVector Negate a vector.
MFloatVector = MFloatVector - MFloatVector Vector subtraction.
MFloatVector -= MFloatVector In-place vector subtraction.

Comparison Support

MFloatVector == MFloatVector Returns True if each component of the first vector is exactly equal to the corresponding component of the second.
MFloatVector != MFloatVector Returns False is any component of the first vector is not exactly equal to the corresponding component of the second.

All other comparison operators will raise a TypeError exception.

© 2011 Autodesk, Inc. All rights reserved.