예제 #1
0
파일: matrix.c 프로젝트: fogleman/Matrix
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;
}
예제 #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);
}
예제 #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);
}
예제 #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);
}