diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-06-18 00:33:34 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-06-18 00:33:34 +0400 |
commit | 489db9994df0bd95ac595922b38391ee68c3088f (patch) | |
tree | 316320fd3c4c4150585afd515a7079c8aa67b3c9 /source/blender/python/generic/Mathutils.h | |
parent | cb68b9434c4967d8985da809b98305b8599a95e2 (diff) |
Some generic modules from blender 2.4x building with py3k and mostly working.
* Mathutils, Geometry, BGL, Mostly working, some //XXX comments for things to fix with py3
python import override (bpy_internal_import.c) so you can import python internal scripts from the BGE and running blender normally.
Diffstat (limited to 'source/blender/python/generic/Mathutils.h')
-rw-r--r-- | source/blender/python/generic/Mathutils.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/source/blender/python/generic/Mathutils.h b/source/blender/python/generic/Mathutils.h new file mode 100644 index 00000000000..4c8153e5e54 --- /dev/null +++ b/source/blender/python/generic/Mathutils.h @@ -0,0 +1,100 @@ +/* + * $Id: Mathutils.h 20332 2009-05-22 03:22:56Z campbellbarton $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * This is a new part of Blender. + * + * Contributor(s): Joseph Gilbert + * + * ***** END GPL LICENSE BLOCK ***** +*/ +//Include this file for access to vector, quat, matrix, euler, etc... + +#ifndef EXPP_Mathutils_H +#define EXPP_Mathutils_H + +#include <Python.h> +#include "vector.h" +#include "matrix.h" +#include "quat.h" +#include "euler.h" + +PyObject *Mathutils_Init( const char * from ); + +PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat); +PyObject *column_vector_multiplication(MatrixObject * mat, VectorObject* vec); +PyObject *quat_rotation(PyObject *arg1, PyObject *arg2); + +PyObject *M_Mathutils_Rand(PyObject * self, PyObject * args); +PyObject *M_Mathutils_Vector(PyObject * self, PyObject * args); +PyObject *M_Mathutils_AngleBetweenVecs(PyObject * self, PyObject * args); +PyObject *M_Mathutils_MidpointVecs(PyObject * self, PyObject * args); +PyObject *M_Mathutils_ProjectVecs(PyObject * self, PyObject * args); +PyObject *M_Mathutils_Matrix(PyObject * self, PyObject * args); +PyObject *M_Mathutils_RotationMatrix(PyObject * self, PyObject * args); +PyObject *M_Mathutils_TranslationMatrix(PyObject * self, VectorObject * value); +PyObject *M_Mathutils_ScaleMatrix(PyObject * self, PyObject * args); +PyObject *M_Mathutils_OrthoProjectionMatrix(PyObject * self, PyObject * args); +PyObject *M_Mathutils_ShearMatrix(PyObject * self, PyObject * args); +PyObject *M_Mathutils_Quaternion(PyObject * self, PyObject * args); +PyObject *M_Mathutils_DifferenceQuats(PyObject * self, PyObject * args); +PyObject *M_Mathutils_Slerp(PyObject * self, PyObject * args); +PyObject *M_Mathutils_Euler(PyObject * self, PyObject * args); +PyObject *M_Mathutils_Intersect( PyObject * self, PyObject * args ); +PyObject *M_Mathutils_TriangleArea( PyObject * self, PyObject * args ); +PyObject *M_Mathutils_TriangleNormal( PyObject * self, PyObject * args ); +PyObject *M_Mathutils_QuadNormal( PyObject * self, PyObject * args ); +PyObject *M_Mathutils_LineIntersect( PyObject * self, PyObject * args ); +//DEPRECATED +PyObject *M_Mathutils_CopyMat(PyObject * self, PyObject * args); +PyObject *M_Mathutils_CopyVec(PyObject * self, PyObject * args); +PyObject *M_Mathutils_CopyQuat(PyObject * self, PyObject * args); +PyObject *M_Mathutils_CopyEuler(PyObject * self, PyObject * args); +PyObject *M_Mathutils_RotateEuler(PyObject * self, PyObject * args); +PyObject *M_Mathutils_MatMultVec(PyObject * self, PyObject * args); +PyObject *M_Mathutils_VecMultMat(PyObject * self, PyObject * args); +PyObject *M_Mathutils_CrossVecs(PyObject * self, PyObject * args); +PyObject *M_Mathutils_DotVecs(PyObject * self, PyObject * args); +PyObject *M_Mathutils_CrossQuats(PyObject * self, PyObject * args); +PyObject *M_Mathutils_DotQuats(PyObject * self, PyObject * args); + +int EXPP_FloatsAreEqual(float A, float B, int floatSteps); +int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps); + + +#define Py_PI 3.14159265358979323846 +#define Py_WRAP 1024 +#define Py_NEW 2048 + + +/* Mathutils is used by the BGE and Blender so have to define + * some things here for luddite mac users of py2.3 */ +#ifndef Py_RETURN_NONE +#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None +#endif +#ifndef Py_RETURN_FALSE +#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False +#endif +#ifndef Py_RETURN_TRUE +#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True +#endif + +#endif /* EXPP_Mathutils_H */ |