ref: 92389067d3f18a023743e79ab0165e63a808d7ba
parent: aca3c45e4dad021937d4c61b05222448f10e74d9
author: rodri <rgl@antares-labs.eu>
date: Fri Jul 25 07:16:05 EDT 2025
xform: add a reference for the equations of persp and ortho projections Song Ho Ahn (안성호) does a magnificient job at deriving the two major projection matrices, and it served as a fundamental resource since our very first implementation, as well as with the latest change to get the orthographic matrix to map correctly to our standard right-handed frames.
--- a/xform.c
+++ b/xform.c
@@ -138,6 +138,9 @@
return rframexform3(p, *e);
}
+/*
+ * adapted from the equations in https://www.songho.ca/opengl/gl_projectionmatrix.html#perspective
+ */
void
perspective(Matrix3 m, double fovy, double a, double n, double f)
{
@@ -152,6 +155,9 @@
m[3][2] = -1;
}
+/*
+ * adapted from the equations in https://www.songho.ca/opengl/gl_projectionmatrix.html#ortho
+ */
void
orthographic(Matrix3 m, double l, double r, double b, double t, double n, double f)
{
--
⑨