Notes:
-
Comparison operators can be done on Vector classes:
-
>, >=, <, <= test the vector magnitude
-
==, != test vector values e.g. 1,2,3 != 1,2,4 even if they
are the same length
-
Math can be performed on Vector classes
-
vec + vec
-
vec - vec
-
vec * float/int
-
vec * matrix
-
vec * vec
-
vec * quat
-
-vec
-
You can access a vector object like a sequence
-
x = vector[0]
-
vec_a[:] vec_b
-
vec2d[:] vec3d[:2]
-
Vectors support 'swizzle' operations
Attention:
Vector data can be wrapped or non-wrapped. When a object is
wrapped it means that the object will give you direct access to the
data inside of blender. Modification of this object will directly
change the data inside of blender. To copy a wrapped object you
need to use the object's constructor. If you copy and object by
assignment you will not get a second copy but a second reference to
the same data. Only certain functions will return wrapped data.
This will be indicated in the method description. Example:
wrappedObject = Object.getAttribute() #this is wrapped data
print wrappedObject.wrapped #prints 'True'
copyOfObject = wrappedObject.copy() #creates a copy of the object
secondPointer = wrappedObject #creates a second pointer to the same data
print wrappedObject.attribute #prints '5'
secondPointer.attribute = 10
print wrappedObject.attribute #prints '10'
print copyOfObject.attribute #prints '5'
Vector object.
|
__init__(list=None)
Create a new 2d, 3d, or 4d Vector object from a list of floating
point numbers. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quaternion
|
|
Vector object matching the size of this vector.
|
|
Vector
|
|
float
|
dot(other)
Return the dot product of this vector and another. |
source code
|
|