Support for arbitrary sized vectors - (was limited by 2-4 previously)

patch http://codereview.appspot.com/5482043
from Andrew Hale

* Text from the submission *

This patch adds the ability to use arbitrary sized vectors from mathutils.
Currently vectors are only of size 2, 3 or 4 since they are generally restricted
to geometric applications. However, we can use arbitrary sized vectors for
efficient calculations and data manipulation.
This commit is contained in:
2011-12-18 07:27:11 +00:00
parent bfdaa3b187
commit 414370b8d4
6 changed files with 563 additions and 81 deletions

View File

@@ -41,11 +41,12 @@ extern PyTypeObject vector_Type;
typedef struct {
BASE_MATH_MEMBERS(vec);
unsigned char size; /* vec size 2,3 or 4 */
int size; /* vec size 2,3 or 4 */
} VectorObject;
/*prototypes*/
PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTypeObject *base_type);
PyObject *Vector_CreatePyObject_cb(PyObject *user, int size, int callback_type, int subtype);
PyObject *Vector_CreatePyObject_alloc(float *vec, const int size, PyTypeObject *base_type);
#endif /* MATHUTILS_VECTOR_H */