diff options
author | Joseph Gilbert <ascotan@gmail.com> | 2004-02-29 16:20:34 +0300 |
---|---|---|
committer | Joseph Gilbert <ascotan@gmail.com> | 2004-02-29 16:20:34 +0300 |
commit | 8f3a9815baafb6f8fe00659cf6390a8c4092ef8b (patch) | |
tree | 9a69af7bffd6fd0d7da8e998d74a37dc273628a2 /source/blender/python/api2_2x/vector.h | |
parent | 2255ac3b19ec3b2aa0e884ad5960f34c9c0efa23 (diff) |
Mathutils library for the python API
- support for quaternions, euler, vector, matrix operations.
- euler supports unique rotation calculation
- new matrix memory construction and internal functions
- quaternion slerp and diff calculation
- 2d, 3d, 4d vector construction and handling
- full conversion support between types
- update to object/window to reflect to matrix type
- update to types/blender/module to reflect new module
Diffstat (limited to 'source/blender/python/api2_2x/vector.h')
-rw-r--r-- | source/blender/python/api2_2x/vector.h | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/source/blender/python/api2_2x/vector.h b/source/blender/python/api2_2x/vector.h index 2e0250c3a07..f8ad164543b 100644 --- a/source/blender/python/api2_2x/vector.h +++ b/source/blender/python/api2_2x/vector.h @@ -1,7 +1,3 @@ - - -/* Matrix and vector objects in Python */ - /* $Id$ * * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** @@ -28,7 +24,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): Willian P. Germano + * Contributor(s): Willian P. Germano & Joseph Gilbert * * ***** END GPL/BL DUAL LICENSE BLOCK ***** * @@ -38,42 +34,39 @@ #define EXPP_vector_h #include "Python.h" - -#include "BKE_utildefines.h" - #include "gen_utils.h" -#include "vector.h" +#include "Types.h" +#include "matrix.h" +#include "BKE_utildefines.h" #ifdef HAVE_CONFIG_H #include <config.h> #endif /*****************************/ -/* Matrix Python Object */ +// Vector Python Object /*****************************/ -/* temporar hack for typecasts */ -typedef float (*Matrix4Ptr)[4]; +#define VectorObject_Check(v) ((v)->ob_type == &vector_Type) typedef struct { PyObject_VAR_HEAD - float *vec; + float * vec; int size; - + int flag; + //0 - no coercion + //1 - coerced from int + //2 - coerced from float } VectorObject; -typedef struct { - PyObject_VAR_HEAD - PyObject *rows[4]; - Matrix4Ptr mat; - Matrix4Ptr mem; -} MatrixObject; - - -/* PROTOS */ - +//prototypes PyObject *newVectorObject(float *vec, int size); -PyObject *newMatrixObject(float mat[][4]); -void init_py_matrix(void); +PyObject *Vector_Zero(VectorObject *self); +PyObject *Vector_Normalize(VectorObject *self); +PyObject *Vector_Negate(VectorObject *self); +PyObject *Vector_Resize2D(VectorObject *self); +PyObject *Vector_Resize3D(VectorObject *self); +PyObject *Vector_Resize4D(VectorObject *self); #endif /* EXPP_vector_h */ + |