Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/mathutils/mathutils_Vector.c
| Show First 20 Lines • Show All 808 Lines • ▼ Show 20 Lines | |||||
| " :rtype: :class:`Vector`\n" | " :rtype: :class:`Vector`\n" | ||||
| "\n" | "\n" | ||||
| " .. note:: the axis is undefined, only use when any orthogonal vector is acceptable.\n" | " .. note:: the axis is undefined, only use when any orthogonal vector is acceptable.\n" | ||||
| ); | ); | ||||
| static PyObject *Vector_orthogonal(VectorObject *self) | static PyObject *Vector_orthogonal(VectorObject *self) | ||||
| { | { | ||||
| float vec[3]; | float vec[3]; | ||||
| if (self->size != 3) { | if (self->size > 3) { | ||||
campbellbarton: can do `(self->size > 3)` | |||||
| PyErr_SetString(PyExc_TypeError, | PyErr_SetString(PyExc_TypeError, | ||||
| "Vector.orthogonal(): " | "Vector.orthogonal(): " | ||||
| "Vector must be 3D"); | "Vector must be 3D or 2D"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (BaseMath_ReadCallback(self) == -1) | if (BaseMath_ReadCallback(self) == -1) | ||||
| return NULL; | return NULL; | ||||
| if (self->size == 3) | |||||
| ortho_v3_v3(vec, self->vec); | ortho_v3_v3(vec, self->vec); | ||||
| else | |||||
| ortho_v2_v2(vec, self->vec); | |||||
| return Vector_CreatePyObject(vec, self->size, Py_NEW, Py_TYPE(self)); | return Vector_CreatePyObject(vec, self->size, Py_NEW, Py_TYPE(self)); | ||||
| } | } | ||||
| /* | /* | ||||
| * Vector.reflect(mirror): return a reflected vector on the mirror normal | * Vector.reflect(mirror): return a reflected vector on the mirror normal | ||||
| * vec - ((2 * DotVecs(vec, mirror)) * mirror) | * vec - ((2 * DotVecs(vec, mirror)) * mirror) | ||||
| ▲ Show 20 Lines • Show All 2,231 Lines • Show Last 20 Lines | |||||
can do (self->size > 3)