Blender V2.61 - r43446
Defines | Functions | Variables

mathutils_Vector.c File Reference

#include <Python.h>
#include "mathutils.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_dynstr.h"

Go to the source code of this file.

Defines

#define MAX_DIMENSIONS   4
#define SWIZZLE_BITS_PER_AXIS   3
#define SWIZZLE_VALID_AXIS   0x4
#define SWIZZLE_AXIS   0x3

Functions

static PyObject * Vector_copy (VectorObject *self)
static PyObject * Vector_to_tuple_ext (VectorObject *self, int ndigits)
static int row_vector_multiplication (float rvec[MAX_DIMENSIONS], VectorObject *vec, MatrixObject *mat)
static PyObject * Vector_new (PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds))
static PyObject * vec__apply_to_copy (PyNoArgsFunction vec_func, VectorObject *self)
 PyDoc_STRVAR (C_Vector_Fill_doc,".. classmethod:: Fill(size, fill=0.0)\n""\n"" Create a vector of length size with all values set to fill.\n""\n"" :arg size: The length of the vector to be created.\n"" :type size: int\n"" :arg fill: The value used to fill the vector.\n"" :type fill: float\n")
static PyObject * C_Vector_Fill (PyObject *cls, PyObject *args)
 PyDoc_STRVAR (C_Vector_Range_doc,".. classmethod:: Range(start=0, stop, step=1)\n""\n"" Create a filled with a range of values.\n""\n"" :arg start: The start of the range used to fill the vector.\n"" :type start: int\n"" :arg stop: The end of the range used to fill the vector.\n"" :type stop: int\n"" :arg step: The step between successive values in the vector.\n"" :type step: int\n")
static PyObject * C_Vector_Range (PyObject *cls, PyObject *args)
 PyDoc_STRVAR (C_Vector_Linspace_doc,".. classmethod:: Linspace(start, stop, size)\n""\n"" Create a vector of the specified size which is filled with linearly spaced values between start and stop values.\n""\n"" :arg start: The start of the range used to fill the vector.\n"" :type start: int\n"" :arg stop: The end of the range used to fill the vector.\n"" :type stop: int\n"" :arg size: The size of the vector to be created.\n"" :type size: int\n")
static PyObject * C_Vector_Linspace (PyObject *cls, PyObject *args)
 PyDoc_STRVAR (C_Vector_Repeat_doc,".. classmethod:: Repeat(vector, size)\n""\n"" Create a vector by repeating the values in vector until the required size is reached.\n""\n"" :arg tuple: The vector to draw values from.\n"" :type tuple: :class:`mathutils.Vector`\n"" :arg size: The size of the vector to be created.\n"" :type size: int\n")
static PyObject * C_Vector_Repeat (PyObject *cls, PyObject *args)
 PyDoc_STRVAR (Vector_zero_doc,".. method:: zero()\n""\n"" Set all values to zero.\n")
static PyObject * Vector_zero (VectorObject *self)
 PyDoc_STRVAR (Vector_normalize_doc,".. method:: normalize()\n""\n"" Normalize the vector, making the length of the vector always 1.0.\n""\n"" .. warning:: Normalizing a vector where all values are zero has no effect.\n""\n"" .. note:: Normalize works for vectors of all sizes,\n"" however 4D Vectors w axis is left untouched.\n")
static PyObject * Vector_normalize (VectorObject *self)
 PyDoc_STRVAR (Vector_normalized_doc,".. method:: normalized()\n""\n"" Return a new, normalized vector.\n""\n"" :return: a normalized copy of the vector\n"" :rtype: :class:`Vector`\n")
static PyObject * Vector_normalized (VectorObject *self)
 PyDoc_STRVAR (Vector_resize_doc,".. method:: resize(size=3)\n""\n"" Resize the vector to have size number of elements.\n""\n"" :return: an instance of itself\n"" :rtype: :class:`Vector`\n")
static PyObject * Vector_resize (VectorObject *self, PyObject *value)
 PyDoc_STRVAR (Vector_resized_doc,".. method:: resized(size=3)\n""\n"" Return a resized copy of the vector with size number of elements.\n""\n"" :return: a new vector\n"" :rtype: :class:`Vector`\n")
static PyObject * Vector_resized (VectorObject *self, PyObject *value)
 PyDoc_STRVAR (Vector_resize_2d_doc,".. method:: resize_2d()\n""\n"" Resize the vector to 2D (x, y).\n""\n"" :return: an instance of itself\n"" :rtype: :class:`Vector`\n")
static PyObject * Vector_resize_2d (VectorObject *self)
 PyDoc_STRVAR (Vector_resize_3d_doc,".. method:: resize_3d()\n""\n"" Resize the vector to 3D (x, y, z).\n""\n"" :return: an instance of itself\n"" :rtype: :class:`Vector`\n")
static PyObject * Vector_resize_3d (VectorObject *self)
 PyDoc_STRVAR (Vector_resize_4d_doc,".. method:: resize_4d()\n""\n"" Resize the vector to 4D (x, y, z, w).\n""\n"" :return: an instance of itself\n"" :rtype: :class:`Vector`\n")
static PyObject * Vector_resize_4d (VectorObject *self)
 PyDoc_STRVAR (Vector_to_2d_doc,".. method:: to_2d()\n""\n"" Return a 2d copy of the vector.\n""\n"" :return: a new vector\n"" :rtype: :class:`Vector`\n")
static PyObject * Vector_to_2d (VectorObject *self)
 PyDoc_STRVAR (Vector_to_3d_doc,".. method:: to_3d()\n""\n"" Return a 3d copy of the vector.\n""\n"" :return: a new vector\n"" :rtype: :class:`Vector`\n")
static PyObject * Vector_to_3d (VectorObject *self)
 PyDoc_STRVAR (Vector_to_4d_doc,".. method:: to_4d()\n""\n"" Return a 4d copy of the vector.\n""\n"" :return: a new vector\n"" :rtype: :class:`Vector`\n")
static PyObject * Vector_to_4d (VectorObject *self)
 PyDoc_STRVAR (Vector_to_tuple_doc,".. method:: to_tuple(precision=-1)\n""\n"" Return this vector as a tuple with.\n""\n"" :arg precision: The number to round the value to in [-1, 21].\n"" :type precision: int\n"" :return: the values of the vector rounded by *precision*\n"" :rtype: tuple\n")
static PyObject * Vector_to_tuple (VectorObject *self, PyObject *args)
 PyDoc_STRVAR (Vector_to_track_quat_doc,".. method:: to_track_quat(track, up)\n""\n"" Return a quaternion rotation from the vector and the track and up axis.\n""\n"" :arg track: Track axis in ['X', 'Y', 'Z', '-X', '-Y', '-Z'].\n"" :type track: string\n"" :arg up: Up axis in ['X', 'Y', 'Z'].\n"" :type up: string\n"" :return: rotation from the vector and the track and up axis.\n"" :rtype: :class:`Quaternion`\n")
static PyObject * Vector_to_track_quat (VectorObject *self, PyObject *args)
 PyDoc_STRVAR (Vector_reflect_doc,".. method:: reflect(mirror)\n""\n"" Return the reflection vector from the *mirror* argument.\n""\n"" :arg mirror: This vector could be a normal from the reflecting surface.\n"" :type mirror: :class:`Vector`\n"" :return: The reflected vector matching the size of this vector.\n"" :rtype: :class:`Vector`\n")
static PyObject * Vector_reflect (VectorObject *self, PyObject *value)
 PyDoc_STRVAR (Vector_cross_doc,".. method:: cross(other)\n""\n"" Return the cross product of this vector and another.\n""\n"" :arg other: The other vector to perform the cross product with.\n"" :type other: :class:`Vector`\n"" :return: The cross product.\n"" :rtype: :class:`Vector`\n""\n"" .. note:: both vectors must be 3D\n")
static PyObject * Vector_cross (VectorObject *self, PyObject *value)
 PyDoc_STRVAR (Vector_dot_doc,".. method:: dot(other)\n""\n"" Return the dot product of this vector and another.\n""\n"" :arg other: The other vector to perform the dot product with.\n"" :type other: :class:`Vector`\n"" :return: The dot product.\n"" :rtype: :class:`Vector`\n")
static PyObject * Vector_dot (VectorObject *self, PyObject *value)
 PyDoc_STRVAR (Vector_angle_doc,".. function:: angle(other, fallback)\n""\n"" Return the angle between two vectors.\n""\n"" :arg other: another vector to compare the angle with\n"" :type other: :class:`Vector`\n"" :arg fallback: return this value when the angle cant be calculated\n"" (zero length vector)\n"" :type fallback: any\n"" :return: angle in radians or fallback when given\n"" :rtype: float\n""\n"" .. note:: Zero length vectors raise an :exc:`AttributeError`.\n")
static PyObject * Vector_angle (VectorObject *self, PyObject *args)
 PyDoc_STRVAR (Vector_rotation_difference_doc,".. function:: rotation_difference(other)\n""\n"" Returns a quaternion representing the rotational difference between this\n"" vector and another.\n""\n"" :arg other: second vector.\n"" :type other: :class:`Vector`\n"" :return: the rotational difference between the two vectors.\n"" :rtype: :class:`Quaternion`\n""\n"" .. note:: 2D vectors raise an :exc:`AttributeError`.\n")
static PyObject * Vector_rotation_difference (VectorObject *self, PyObject *value)
 PyDoc_STRVAR (Vector_project_doc,".. function:: project(other)\n""\n"" Return the projection of this vector onto the *other*.\n""\n"" :arg other: second vector.\n"" :type other: :class:`Vector`\n"" :return: the parallel projection vector\n"" :rtype: :class:`Vector`\n")
static PyObject * Vector_project (VectorObject *self, PyObject *value)
 PyDoc_STRVAR (Vector_lerp_doc,".. function:: lerp(other, factor)\n""\n"" Returns the interpolation of two vectors.\n""\n"" :arg other: value to interpolate with.\n"" :type other: :class:`Vector`\n"" :arg factor: The interpolation value in [0.0, 1.0].\n"" :type factor: float\n"" :return: The interpolated rotation.\n"" :rtype: :class:`Vector`\n")
static PyObject * Vector_lerp (VectorObject *self, PyObject *args)
 PyDoc_STRVAR (Vector_rotate_doc,".. function:: rotate(other)\n""\n"" Return vector by a rotation value.\n""\n"" :arg other: rotation component of mathutils value\n"" :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n")
static PyObject * Vector_rotate (VectorObject *self, PyObject *value)
 PyDoc_STRVAR (Vector_copy_doc,".. function:: copy()\n""\n"" Returns a copy of this vector.\n""\n"" :return: A copy of the vector.\n"" :rtype: :class:`Vector`\n""\n"" .. note:: use this to get a copy of a wrapped vector with\n"" no reference to the original data.\n")
static PyObject * Vector_repr (VectorObject *self)
static PyObject * Vector_str (VectorObject *self)
static int Vector_len (VectorObject *self)
static PyObject * vector_item_internal (VectorObject *self, int i, const int is_attr)
static PyObject * Vector_item (VectorObject *self, int i)
static int vector_ass_item_internal (VectorObject *self, int i, PyObject *value, const int is_attr)
static int Vector_ass_item (VectorObject *self, int i, PyObject *value)
static PyObject * Vector_slice (VectorObject *self, int begin, int end)
static int Vector_ass_slice (VectorObject *self, int begin, int end, PyObject *seq)
static PyObject * Vector_add (PyObject *v1, PyObject *v2)
static PyObject * Vector_iadd (PyObject *v1, PyObject *v2)
static PyObject * Vector_sub (PyObject *v1, PyObject *v2)
static PyObject * Vector_isub (PyObject *v1, PyObject *v2)
int column_vector_multiplication (float r_vec[MAX_DIMENSIONS], VectorObject *vec, MatrixObject *mat)
static PyObject * vector_mul_float (VectorObject *vec, const float scalar)
static PyObject * Vector_mul (PyObject *v1, PyObject *v2)
static PyObject * Vector_imul (PyObject *v1, PyObject *v2)
static PyObject * Vector_div (PyObject *v1, PyObject *v2)
static PyObject * Vector_idiv (PyObject *v1, PyObject *v2)
static PyObject * Vector_neg (VectorObject *self)
static double vec_magnitude_nosqrt (float *data, int size)
static PyObject * Vector_richcmpr (PyObject *objectA, PyObject *objectB, int comparison_type)
static PyObject * Vector_subscript (VectorObject *self, PyObject *item)
static int Vector_ass_subscript (VectorObject *self, PyObject *item, PyObject *value)
 PyDoc_STRVAR (Vector_axis_x_doc,"Vector X axis.\n\n:type: float")
 PyDoc_STRVAR (Vector_axis_y_doc,"Vector Y axis.\n\n:type: float")
 PyDoc_STRVAR (Vector_axis_z_doc,"Vector Z axis (3D Vectors only).\n\n:type: float")
 PyDoc_STRVAR (Vector_axis_w_doc,"Vector W axis (4D Vectors only).\n\n:type: float")
static PyObject * Vector_axis_get (VectorObject *self, void *type)
static int Vector_axis_set (VectorObject *self, PyObject *value, void *type)
 PyDoc_STRVAR (Vector_length_doc,"Vector Length.\n\n:type: float")
static PyObject * Vector_length_get (VectorObject *self, void *UNUSED(closure))
static int Vector_length_set (VectorObject *self, PyObject *value)
 PyDoc_STRVAR (Vector_length_squared_doc,"Vector length squared (v.dot(v)).\n\n:type: float")
static PyObject * Vector_length_squared_get (VectorObject *self, void *UNUSED(closure))
static PyObject * Vector_swizzle_get (VectorObject *self, void *closure)
static int Vector_swizzle_set (VectorObject *self, PyObject *value, void *closure)
 PyDoc_STRVAR (Vector_negate_doc,".. method:: negate()\n""\n"" Set all values to their negative.\n""\n"" :return: an instance of itself\n"" :rtype: :class:`Vector`\n")
static PyObject * Vector_negate (VectorObject *self)
 PyDoc_STRVAR (vector_doc,"This object gives access to Vectors in Blender.")
PyObject * Vector_CreatePyObject (float *vec, const int size, const int type, PyTypeObject *base_type)
PyObject * Vector_CreatePyObject_cb (PyObject *cb_user, int size, int cb_type, int cb_subtype)
PyObject * Vector_CreatePyObject_alloc (float *vec, const int size, PyTypeObject *base_type)

Variables

static PySequenceMethods Vector_SeqMethods
static PyMappingMethods Vector_AsMapping
static PyNumberMethods Vector_NumMethods
static PyGetSetDef Vector_getseters []
static struct PyMethodDef Vector_methods []
PyTypeObject vector_Type

Detailed Description

Definition in file mathutils_Vector.c.


Define Documentation

#define MAX_DIMENSIONS   4
#define SWIZZLE_AXIS   0x3

Definition at line 47 of file mathutils_Vector.c.

Referenced by Vector_swizzle_get(), and Vector_swizzle_set().

#define SWIZZLE_BITS_PER_AXIS   3

Definition at line 45 of file mathutils_Vector.c.

Referenced by Vector_swizzle_get(), and Vector_swizzle_set().

#define SWIZZLE_VALID_AXIS   0x4

Definition at line 46 of file mathutils_Vector.c.

Referenced by Vector_swizzle_get(), and Vector_swizzle_set().


Function Documentation

static PyObject* C_Vector_Fill ( PyObject *  cls,
PyObject *  args 
) [static]

Definition at line 116 of file mathutils_Vector.c.

References fill_vn_fl(), NULL, size(), and Vector_CreatePyObject_alloc().

static PyObject* C_Vector_Linspace ( PyObject *  cls,
PyObject *  args 
) [static]

Definition at line 223 of file mathutils_Vector.c.

References NULL, range_vn_fl(), size(), step(), and Vector_CreatePyObject_alloc().

static PyObject* C_Vector_Range ( PyObject *  cls,
PyObject *  args 
) [static]

Definition at line 158 of file mathutils_Vector.c.

References NULL, range_vn_fl(), size(), step(), and Vector_CreatePyObject_alloc().

static PyObject* C_Vector_Repeat ( PyObject *  cls,
PyObject *  args 
) [static]
int column_vector_multiplication ( float  r_vec[MAX_DIMENSIONS],
VectorObject vec,
MatrixObject mat 
)
PyDoc_STRVAR ( C_Vector_Range_doc  ,
".. classmethod:: Range(start=0, stop, step=1)\n""\n"" Create a filled with a range of values.\n""\n"" :arg start: The start of the range used to fill the vector.\n"" :type start: int\n"" :arg stop: The end of the range used to fill the vector.\n"" :type stop: int\n"" :arg step: The step between successive values in the vector.\n"" :type step: int\n"   
)
PyDoc_STRVAR ( Vector_to_3d_doc  ,
".. method:: to_3d()\n""\n"" Return a 3d copy of the vector.\n""\n"" :return: a new vector\n"" :rtype: :class:`Vector`\n"   
)
PyDoc_STRVAR ( Vector_normalize_doc  ,
".. method:: normalize()\n""\n"" Normalize the  vector,
making the length of the vector always 1.0.\n""\n""..warning::Normalizing a vector where all values are zero has no effect.\n""\n""..note::Normalize works for vectors of all  sizes,
\n""however 4D Vectors w axis is left untouched.\n"   
)
PyDoc_STRVAR ( Vector_to_4d_doc  ,
".. method:: to_4d()\n""\n"" Return a 4d copy of the vector.\n""\n"" :return: a new vector\n"" :rtype: :class:`Vector`\n"   
)
PyDoc_STRVAR ( Vector_normalized_doc  ,
".. method:: normalized()\n""\n"" Return a  new,
normalized vector.\n""\n"":return:a normalized copy of the vector\n"":rtype::class:`Vector`\n"   
)
PyDoc_STRVAR ( Vector_to_tuple_doc  ,
".. method:: to_tuple(precision=-1)\n""\n"" Return this vector as a tuple with.\n""\n"" :arg precision: The number to round the value to in .\n"" :type precision: int\n"" :return: the values of the vector rounded by *precision*\n"" :rtype: tuple\n"  [-1, 21] 
)
PyDoc_STRVAR ( Vector_to_track_quat_doc  ,
".. method:: to_track_quat(track, up)\n""\n"" Return a quaternion rotation from the vector and the track and up axis.\n""\n"" :arg track: Track axis in .\n"" :type track: string\n"" :arg up: Up axis in .\n"" :type up: string\n"" :return: rotation from the vector and the track and up axis.\n"" :rtype: :class:`Quaternion`\n"  ['X', 'Y', 'Z', '-X', '-Y', '-Z']['X', 'Y', 'Z'] 
)
PyDoc_STRVAR ( Vector_resize_doc  ,
".. method:: resize(size=3)\n""\n"" Resize the vector to have size number of elements.\n""\n"" :return: an instance of itself\n"" :rtype: :class:`Vector`\n"   
)
PyDoc_STRVAR ( Vector_reflect_doc  ,
".. method:: reflect(mirror)\n""\n"" Return the reflection vector from the *mirror* argument.\n""\n"" :arg mirror: This vector could be a normal from the reflecting surface.\n"" :type mirror: :class:`Vector`\n"" :return: The reflected vector matching the size of this vector.\n"" :rtype: :class:`Vector`\n"   
)
PyDoc_STRVAR ( Vector_axis_x_doc  ,
"Vector X axis.\n\n:type: float"   
)
PyDoc_STRVAR ( Vector_axis_y_doc  ,
"Vector Y axis.\n\n:type: float"   
)
PyDoc_STRVAR ( Vector_axis_z_doc  ,
"Vector Z axis (3D Vectors only).\n\n:type: float"   
)
PyDoc_STRVAR ( Vector_cross_doc  ,
".. method:: cross(other)\n""\n"" Return the cross product of this vector and another.\n""\n"" :arg other: The other vector to perform the cross product with.\n"" :type other: :class:`Vector`\n"" :return: The cross product.\n"" :rtype: :class:`Vector`\n""\n"" .. note:: both vectors must be 3D\n"   
)
PyDoc_STRVAR ( Vector_axis_w_doc  ,
"Vector W axis (4D Vectors only).\n\n:type: float"   
)
PyDoc_STRVAR ( Vector_length_doc  ,
"Vector Length.\n\n:type: float"   
)
PyDoc_STRVAR ( C_Vector_Linspace_doc  ,
".. classmethod:: Linspace(start, stop, size)\n""\n"" Create a vector of the specified size which is filled with linearly spaced values between start and stop values.\n""\n"" :arg start: The start of the range used to fill the vector.\n"" :type start: int\n"" :arg stop: The end of the range used to fill the vector.\n"" :type stop: int\n"" :arg size: The size of the vector to be created.\n"" :type size: int\n"   
)
PyDoc_STRVAR ( Vector_resized_doc  ,
".. method:: resized(size=3)\n""\n"" Return a resized copy of the vector with size number of elements.\n""\n"" :return: a new vector\n"" :rtype: :class:`Vector`\n"   
)
PyDoc_STRVAR ( Vector_dot_doc  ,
".. method:: dot(other)\n""\n"" Return the dot product of this vector and another.\n""\n"" :arg other: The other vector to perform the dot product with.\n"" :type other: :class:`Vector`\n"" :return: The dot product.\n"" :rtype: :class:`Vector`\n"   
)
PyDoc_STRVAR ( Vector_length_squared_doc  ,
"Vector length squared (v.dot(v)).\n\n:type: float"   
)
PyDoc_STRVAR ( Vector_angle_doc  ,
".. function:: angle(other, fallback)\n""\n"" Return the angle between two vectors.\n""\n"" :arg other: another vector to compare the angle with\n"" :type other: :class:`Vector`\n"" :arg fallback: return this value when the angle cant be calculated\n"" (zero length vector)\n"" :type fallback: any\n"" :return: angle in radians or fallback when given\n"" :rtype: float\n""\n"" .. note:: Zero length vectors raise an :exc:`AttributeError`.\n"   
)
PyDoc_STRVAR ( Vector_negate_doc  ,
".. method:: negate()\n""\n"" Set all values to their negative.\n""\n"" :return: an instance of itself\n"" :rtype: :class:`Vector`\n"   
)
PyDoc_STRVAR ( C_Vector_Fill_doc  ,
".. classmethod:: Fill(size, fill=0.0)\n""\n"" Create a vector of length size with all values set to fill.\n""\n"" :arg size: The length of the vector to be created.\n"" :type size: int\n"" :arg fill: The value used to fill the vector.\n"" :type fill: float\n"   
)
PyDoc_STRVAR ( Vector_resize_2d_doc  ,
".. method:: resize_2d()\n""\n"" Resize the vector to 2D (x, y).\n""\n"" :return: an instance of itself\n"" :rtype: :class:`Vector`\n"   
)
PyDoc_STRVAR ( Vector_rotation_difference_doc  ,
".. function:: rotation_difference(other)\n""\n"" Returns a quaternion representing the rotational difference between this\n"" vector and another.\n""\n"" :arg other: second vector.\n"" :type other: :class:`Vector`\n"" :return: the rotational difference between the two vectors.\n"" :rtype: :class:`Quaternion`\n""\n"" .. note:: 2D vectors raise an :exc:`AttributeError`.\n"   
)
PyDoc_STRVAR ( vector_doc  ,
"This object gives access to Vectors in Blender."   
)
PyDoc_STRVAR ( Vector_project_doc  ,
".. function:: project(other)\n""\n"" Return the projection of this vector onto the *other*.\n""\n"" :arg other: second vector.\n"" :type other: :class:`Vector`\n"" :return: the parallel projection vector\n"" :rtype: :class:`Vector`\n"   
)
PyDoc_STRVAR ( C_Vector_Repeat_doc  ,
".. classmethod:: Repeat(vector, size)\n""\n"" Create a vector by repeating the values in vector until the required size is reached.\n""\n"" :arg tuple: The vector to draw values from.\n"" :type tuple: :class:`mathutils.Vector`\n"" :arg size: The size of the vector to be created.\n"" :type size: int\n"   
)
PyDoc_STRVAR ( Vector_resize_3d_doc  ,
".. method:: resize_3d()\n""\n"" Resize the vector to 3D (x, y, z).\n""\n"" :return: an instance of itself\n"" :rtype: :class:`Vector`\n"   
)
PyDoc_STRVAR ( Vector_lerp_doc  ,
".. function:: lerp(other, factor)\n""\n"" Returns the interpolation of two vectors.\n""\n"" :arg other: value to interpolate with.\n"" :type other: :class:`Vector`\n"" :arg factor: The interpolation value in .\n"" :type factor: float\n"" :return: The interpolated rotation.\n"" :rtype: :class:`Vector`\n"  [0.0, 1.0] 
)
PyDoc_STRVAR ( Vector_rotate_doc  ,
".. function:: rotate(other)\n""\n"" Return vector by a rotation value.\n""\n"" :arg other: rotation component of mathutils value\n"" :type other: :class:`Euler`  ,
:class:`Quaternion`or:class:`Matrix`\n"   
)
PyDoc_STRVAR ( Vector_zero_doc  ,
".. method:: zero()\n""\n"" Set all values to zero.\n"   
)
PyDoc_STRVAR ( Vector_resize_4d_doc  ,
".. method:: resize_4d()\n""\n"" Resize the vector to 4D (x, y, z, w).\n""\n"" :return: an instance of itself\n"" :rtype: :class:`Vector`\n"   
)
PyDoc_STRVAR ( Vector_copy_doc  ,
".. function:: copy()\n""\n"" Returns a copy of this vector.\n""\n"" :return: A copy of the vector.\n"" :rtype: :class:`Vector`\n""\n"" .. note:: use this to get a copy of a wrapped vector with\n"" no reference to the original data.\n"   
)
PyDoc_STRVAR ( Vector_to_2d_doc  ,
".. method:: to_2d()\n""\n"" Return a 2d copy of the vector.\n""\n"" :return: a new vector\n"" :rtype: :class:`Vector`\n"   
)
static int row_vector_multiplication ( float  rvec[MAX_DIMENSIONS],
VectorObject vec,
MatrixObject mat 
) [static]
static PyObject* vec__apply_to_copy ( PyNoArgsFunction  vec_func,
VectorObject self 
) [static]

Definition at line 91 of file mathutils_Vector.c.

References NULL, and Vector_copy().

Referenced by Vector_normalized().

static double vec_magnitude_nosqrt ( float *  data,
int  size 
) [static]

Definition at line 1803 of file mathutils_Vector.c.

References dot_vn_vn().

Referenced by Vector_richcmpr().

static PyObject* Vector_add ( PyObject *  v1,
PyObject *  v2 
) [static]
static PyObject* Vector_angle ( VectorObject self,
PyObject *  args 
) [static]
static int Vector_ass_item ( VectorObject self,
int  i,
PyObject *  value 
) [static]

Definition at line 1267 of file mathutils_Vector.c.

References FALSE, and vector_ass_item_internal().

Referenced by Vector_ass_subscript().

static int vector_ass_item_internal ( VectorObject self,
int  i,
PyObject *  value,
const int  is_attr 
) [static]

Definition at line 1235 of file mathutils_Vector.c.

References BaseMath_WriteIndexCallback, and i.

Referenced by Vector_ass_item(), and Vector_axis_set().

static int Vector_ass_slice ( VectorObject self,
int  begin,
int  end,
PyObject *  seq 
) [static]
static int Vector_ass_subscript ( VectorObject self,
PyObject *  item,
PyObject *  value 
) [static]

Definition at line 1949 of file mathutils_Vector.c.

References i, step(), Vector_ass_item(), and Vector_ass_slice().

static PyObject* Vector_axis_get ( VectorObject self,
void *  type 
) [static]

Definition at line 2034 of file mathutils_Vector.c.

References GET_INT_FROM_POINTER, TRUE, and vector_item_internal().

static int Vector_axis_set ( VectorObject self,
PyObject *  value,
void *  type 
) [static]

Definition at line 2039 of file mathutils_Vector.c.

References GET_INT_FROM_POINTER, TRUE, and vector_ass_item_internal().

static PyObject * Vector_copy ( VectorObject self) [static]

Definition at line 1156 of file mathutils_Vector.c.

References BaseMath_ReadCallback, NULL, Py_NEW, and Vector_CreatePyObject().

Referenced by vec__apply_to_copy().

PyObject* Vector_CreatePyObject ( float *  vec,
const int  size,
const int  type,
PyTypeObject *  base_type 
)
PyObject* Vector_CreatePyObject_alloc ( float *  vec,
const int  size,
PyTypeObject *  base_type 
)
PyObject* Vector_CreatePyObject_cb ( PyObject *  cb_user,
int  size,
int  cb_type,
int  cb_subtype 
)
static PyObject* Vector_cross ( VectorObject self,
PyObject *  value 
) [static]
static PyObject* Vector_div ( PyObject *  v1,
PyObject *  v2 
) [static]
static PyObject* Vector_dot ( VectorObject self,
PyObject *  value 
) [static]
static PyObject* Vector_iadd ( PyObject *  v1,
PyObject *  v2 
) [static]
static PyObject* Vector_idiv ( PyObject *  v1,
PyObject *  v2 
) [static]
static PyObject* Vector_imul ( PyObject *  v1,
PyObject *  v2 
) [static]
static PyObject* Vector_isub ( PyObject *  v1,
PyObject *  v2 
) [static]
static PyObject* Vector_item ( VectorObject self,
int  i 
) [static]

Definition at line 1230 of file mathutils_Vector.c.

References FALSE, and vector_item_internal().

Referenced by Vector_subscript().

static PyObject* vector_item_internal ( VectorObject self,
int  i,
const int  is_attr 
) [static]

Definition at line 1207 of file mathutils_Vector.c.

References BaseMath_ReadIndexCallback, i, and NULL.

Referenced by Vector_axis_get(), and Vector_item().

static int Vector_len ( VectorObject self) [static]

Definition at line 1202 of file mathutils_Vector.c.

static PyObject* Vector_length_get ( VectorObject self,
void *  UNUSEDclosure 
) [static]

Definition at line 2049 of file mathutils_Vector.c.

References BaseMath_ReadCallback, dot_vn_vn(), NULL, and sqrt().

static int Vector_length_set ( VectorObject self,
PyObject *  value 
) [static]
static PyObject* Vector_length_squared_get ( VectorObject self,
void *  UNUSEDclosure 
) [static]

Definition at line 2103 of file mathutils_Vector.c.

References BaseMath_ReadCallback, dot_vn_vn(), and NULL.

static PyObject* Vector_lerp ( VectorObject self,
PyObject *  args 
) [static]
static PyObject* Vector_mul ( PyObject *  v1,
PyObject *  v2 
) [static]
static PyObject* vector_mul_float ( VectorObject vec,
const float  scalar 
) [static]

Definition at line 1524 of file mathutils_Vector.c.

References mul_vn_vn_fl(), NULL, VectorObject::size, and Vector_CreatePyObject_alloc().

Referenced by Vector_mul().

static PyObject* Vector_neg ( VectorObject self) [static]
static PyObject* Vector_negate ( VectorObject self) [static]

Definition at line 2672 of file mathutils_Vector.c.

References BaseMath_ReadCallback, BaseMath_WriteCallback, negate_vn(), and NULL.

static PyObject* Vector_new ( PyTypeObject *  type,
PyObject *  args,
PyObject *  UNUSEDkwds 
) [static]
static PyObject* Vector_normalize ( VectorObject self) [static]

Definition at line 342 of file mathutils_Vector.c.

References BaseMath_ReadCallback, BaseMath_WriteCallback, normalize_vn(), NULL, and size().

Referenced by Vector_normalized().

static PyObject* Vector_normalized ( VectorObject self) [static]

Definition at line 361 of file mathutils_Vector.c.

References vec__apply_to_copy(), and Vector_normalize().

static PyObject* Vector_project ( VectorObject self,
PyObject *  value 
) [static]
static PyObject* Vector_reflect ( VectorObject self,
PyObject *  value 
) [static]
static PyObject* Vector_repr ( VectorObject self) [static]

Definition at line 1164 of file mathutils_Vector.c.

References BaseMath_ReadCallback, NULL, and Vector_to_tuple_ext().

static PyObject* Vector_resize ( VectorObject self,
PyObject *  value 
) [static]

Definition at line 374 of file mathutils_Vector.c.

References fill_vn_fl(), NULL, Py_WRAP, and size().

static PyObject* Vector_resize_2d ( VectorObject self) [static]

Definition at line 469 of file mathutils_Vector.c.

References NULL, and Py_WRAP.

static PyObject* Vector_resize_3d ( VectorObject self) [static]

Definition at line 504 of file mathutils_Vector.c.

References NULL, and Py_WRAP.

static PyObject* Vector_resize_4d ( VectorObject self) [static]

Definition at line 542 of file mathutils_Vector.c.

References NULL, and Py_WRAP.

static PyObject* Vector_resized ( VectorObject self,
PyObject *  value 
) [static]

Definition at line 429 of file mathutils_Vector.c.

References fill_vn_fl(), NULL, size(), and Vector_CreatePyObject_alloc().

static PyObject* Vector_richcmpr ( PyObject *  objectA,
PyObject *  objectB,
int  comparison_type 
) [static]
static PyObject* Vector_rotate ( VectorObject self,
PyObject *  value 
) [static]
static PyObject* Vector_rotation_difference ( VectorObject self,
PyObject *  value 
) [static]
static PyObject* Vector_slice ( VectorObject self,
int  begin,
int  end 
) [static]

Definition at line 1273 of file mathutils_Vector.c.

References BaseMath_ReadCallback, CLAMP(), MIN2, and NULL.

Referenced by Vector_subscript().

static PyObject* Vector_str ( VectorObject self) [static]
static PyObject* Vector_sub ( PyObject *  v1,
PyObject *  v2 
) [static]
static PyObject* Vector_subscript ( VectorObject self,
PyObject *  item 
) [static]

Definition at line 1912 of file mathutils_Vector.c.

References i, NULL, step(), Vector_item(), and Vector_slice().

static PyObject* Vector_swizzle_get ( VectorObject self,
void *  closure 
) [static]
static int Vector_swizzle_set ( VectorObject self,
PyObject *  value,
void *  closure 
) [static]
static PyObject* Vector_to_2d ( VectorObject self) [static]

Definition at line 583 of file mathutils_Vector.c.

References BaseMath_ReadCallback, NULL, Py_NEW, and Vector_CreatePyObject().

static PyObject* Vector_to_3d ( VectorObject self) [static]

Definition at line 598 of file mathutils_Vector.c.

References BaseMath_ReadCallback, MIN2, NULL, Py_NEW, and Vector_CreatePyObject().

static PyObject* Vector_to_4d ( VectorObject self) [static]

Definition at line 616 of file mathutils_Vector.c.

References BaseMath_ReadCallback, MIN2, NULL, Py_NEW, and Vector_CreatePyObject().

static PyObject* Vector_to_track_quat ( VectorObject self,
PyObject *  args 
) [static]
static PyObject* Vector_to_tuple ( VectorObject self,
PyObject *  args 
) [static]

Definition at line 659 of file mathutils_Vector.c.

References BaseMath_ReadCallback, NULL, and Vector_to_tuple_ext().

static PyObject * Vector_to_tuple_ext ( VectorObject self,
int  ndigits 
) [static]

Definition at line 638 of file mathutils_Vector.c.

References double_round(), and i.

Referenced by Vector_repr(), and Vector_to_tuple().

static PyObject* Vector_zero ( VectorObject self) [static]

Definition at line 322 of file mathutils_Vector.c.

References BaseMath_WriteCallback, fill_vn_fl(), and NULL.


Variable Documentation

PyMappingMethods Vector_AsMapping [static]
Initial value:
 {
    (lenfunc)Vector_len,
    (binaryfunc)Vector_subscript,
    (objobjargproc)Vector_ass_subscript
}

Definition at line 1981 of file mathutils_Vector.c.

PyGetSetDef Vector_getseters[] [static]

Definition at line 2232 of file mathutils_Vector.c.

struct PyMethodDef Vector_methods[] [static]

Definition at line 2683 of file mathutils_Vector.c.

PyNumberMethods Vector_NumMethods [static]

Definition at line 1988 of file mathutils_Vector.c.

PySequenceMethods Vector_SeqMethods [static]
Initial value:
 {
    (lenfunc) Vector_len,               
    (binaryfunc) NULL,                  
    (ssizeargfunc) NULL,                
    (ssizeargfunc) Vector_item,         
    NULL,                               
    (ssizeobjargproc) Vector_ass_item,  
    NULL,                               
    (objobjproc) NULL,                  
    (binaryfunc) NULL,                  
    (ssizeargfunc) NULL,                
}

Definition at line 1899 of file mathutils_Vector.c.

PyTypeObject vector_Type