summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-05-22 18:16:16 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-05-22 18:16:16 -0400
commit79508ee5172600a5aefad2473b73e1fd2d9b2164 (patch)
tree9eb47b4d7eca53568ccd646d60c9a00a0febd8d8
parent95acde693f9d217b9a035585cd9087042503727e (diff)
downloaddimension-79508ee5172600a5aefad2473b73e1fd2d9b2164.tar.xz
geometry: Add a matrix constructor from column vectors.
-rw-r--r--libdimension/dimension/geometry.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libdimension/dimension/geometry.h b/libdimension/dimension/geometry.h
index 59fb285..d2479f3 100644
--- a/libdimension/dimension/geometry.h
+++ b/libdimension/dimension/geometry.h
@@ -159,6 +159,17 @@ dmnsn_new_matrix(double a0, double a1, double a2, double a3,
return m;
}
+/** Construct a new transformation matrix from column vectors. */
+DMNSN_INLINE dmnsn_matrix
+dmnsn_new_matrix4(dmnsn_vector a, dmnsn_vector b, dmnsn_vector c,
+ dmnsn_vector d)
+{
+ dmnsn_matrix m = { { { a.x, b.x, c.x, d.x },
+ { a.y, b.y, c.y, d.y },
+ { a.z, b.z, c.z, d.z } } };
+ return m;
+}
+
/** Return the identity matrix. */
dmnsn_matrix dmnsn_identity_matrix(void);