| 1059 | "\n" |
| 1060 | " .. note:: both vectors must be 2D or 3D\n"); |
| 1061 | static PyObject *Vector_cross(VectorObject *self, PyObject *value) |
| 1062 | { |
| 1063 | PyObject *ret; |
| 1064 | float tvec[3]; |
| 1065 | |
| 1066 | if (BaseMath_ReadCallback(self) == -1) { |
| 1067 | return nullptr; |
| 1068 | } |
| 1069 | |
| 1070 | if (self->vec_num > 3) { |
| 1071 | PyErr_SetString(PyExc_ValueError, "Vector must be 2D or 3D"); |
| 1072 | return nullptr; |
| 1073 | } |
| 1074 | |
| 1075 | if (mathutils_array_parse( |
| 1076 | tvec, self->vec_num, self->vec_num, value, "Vector.cross(other), invalid 'other' arg") == |
| 1077 | -1) |
| 1078 | { |
| 1079 | return nullptr; |
| 1080 | } |
| 1081 | |
| 1082 | if (self->vec_num == 3) { |
| 1083 | ret = Vector_CreatePyObject(nullptr, 3, Py_TYPE(self)); |
| 1084 | cross_v3_v3v3((reinterpret_cast<VectorObject *>(ret))->vec, self->vec, tvec); |
| 1085 | } |
| 1086 | else { |
| 1087 | /* size == 2 */ |
| 1088 | ret = PyFloat_FromDouble(cross_v2v2(self->vec, tvec)); |
| 1089 | } |
| 1090 | return ret; |
| 1091 | } |
| 1092 | |
| 1093 | /** \} */ |
| 1094 |
nothing calls this directly
no test coverage detected