summaryrefslogtreecommitdiffstats
path: root/libdimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-06-14 01:48:03 +0000
committerTavian Barnes <tavianator@gmail.com>2009-06-14 01:48:03 +0000
commit355ab840bbfe94604c5a86afccf23efacdbe97d7 (patch)
tree35083f4cb0fed99497c2b566ed3b7aecd43d998d /libdimension
parent30cf67b4ff1def502b3e01b6b10d2a8b0f737dd4 (diff)
downloaddimension-355ab840bbfe94604c5a86afccf23efacdbe97d7.tar.xz
New dmnsn_scale_matrix() function.
Diffstat (limited to 'libdimension')
-rw-r--r--libdimension/dimension/geometry.h2
-rw-r--r--libdimension/geometry.c9
2 files changed, 11 insertions, 0 deletions
diff --git a/libdimension/dimension/geometry.h b/libdimension/dimension/geometry.h
index ca10163..fccd1bc 100644
--- a/libdimension/dimension/geometry.h
+++ b/libdimension/dimension/geometry.h
@@ -50,6 +50,8 @@ dmnsn_matrix dmnsn_matrix_construct(double a0, double a1, double a2, double a3,
double b0, double b1, double b2, double b3,
double c0, double c1, double c2, double c3,
double d0, double d1, double d2, double d3);
+
+dmnsn_matrix dmnsn_scale_matrix(dmnsn_vector s);
dmnsn_matrix dmnsn_translation_matrix(dmnsn_vector d);
/* theta/|theta| = axis, |theta| = angle */
dmnsn_matrix dmnsn_rotation_matrix(dmnsn_vector theta);
diff --git a/libdimension/geometry.c b/libdimension/geometry.c
index 846095c..a89fb9e 100644
--- a/libdimension/geometry.c
+++ b/libdimension/geometry.c
@@ -43,6 +43,15 @@ dmnsn_matrix_construct(double a0, double a1, double a2, double a3,
return m;
}
+dmnsn_matrix
+dmnsn_scale_matrix(dmnsn_vector s)
+{
+ return dmnsn_matrix_construct(s.x, 0.0, 0.0, 0.0,
+ 0.0, s.y, 0.0, 0.0,
+ 0.0, 0.0, s.z, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+}
+
/* Translation matrix */
dmnsn_matrix
dmnsn_translation_matrix(dmnsn_vector d)