Beispiel #1
0
static PyObject * Vector3D_rotate(PyVector3D * self, PyQuaternion * arg)
{
    if (!PyQuaternion_Check(arg)) {
        PyErr_SetString(PyExc_TypeError, "Can only rotate with a quaternion");
        return NULL;
    }
    self->coords.rotate(arg->rotation);
    Py_INCREF(Py_None);
    return Py_None;
}
Beispiel #2
0
PyObject * Quaternium_num_mult(PyQuaternion * self, PyQuaternion * other)
{
    if (!PyQuaternion_Check(other)) {
        PyErr_SetString(PyExc_TypeError, "Quaternion must be multiplied by Quaternion");
        return NULL;
    }
    PyQuaternion * ret = newPyQuaternion();
    if (ret != NULL) {
        ret->rotation = self->rotation * other->rotation;
    }
    return (PyObject *)ret;
}