Beispiel #1
0
static PyObject *matrix_mul(Matrix *self, PyObject *arg) {
    if (PyObject_IsInstance(arg, (PyObject *)&MatrixType)) {
        Matrix *result = (Matrix *)matrix_identity(NULL);
        double *m = result->data;
        double *a = self->data;
        double *b = ((Matrix *)arg)->data;
        mat_mat_multiply(m, a, b);
        return (PyObject *)result;
    }
    return NULL;
}
Beispiel #2
0
void scale(double sx, double sy, double sz, matrix m) {
	matrix temp = mat_mat_multiply(scale_matrix(sx, sy, sz), m);
	memcpy(m, temp, 16 * sizeof(double));
	free(temp);
}
Beispiel #3
0
void translate(double i, double j, double k, matrix m) {
	matrix temp = mat_mat_multiply(translation_matrix(i, j, k), m);
	memcpy(m, temp, 16 * sizeof(double));
	free(temp);
}
Beispiel #4
0
void rotate_z(double theta, matrix m) {
	matrix temp = mat_mat_multiply(rotation_matrix_z(theta), m);
	memcpy(m, temp, 16 * sizeof(double));
	free(temp);
}