/* note: BaseMath_ReadCallback must be called beforehand */ static PyObject *Color_ToTupleExt(ColorObject *self, int ndigits) { PyObject *ret; int i; ret= PyTuple_New(COLOR_SIZE); if (ndigits >= 0) { for (i= 0; i < COLOR_SIZE; i++) { PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->col[i], ndigits))); } } else { for (i= 0; i < COLOR_SIZE; i++) { PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(self->col[i])); } } return ret; }
/* note: BaseMath_ReadCallback must be called beforehand */ static PyObject *Quaternion_to_tuple_ext(QuaternionObject *self, int ndigits) { PyObject *ret; int i; ret = PyTuple_New(QUAT_SIZE); if (ndigits >= 0) { for (i = 0; i < QUAT_SIZE; i++) { PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->quat[i], ndigits))); } } else { for (i = 0; i < QUAT_SIZE; i++) { PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(self->quat[i])); } } return ret; }