From 8f0bcb50c453e01577af7528fdc90d6a67c558da Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Sun, 6 Dec 2015 16:24:28 -0500 Subject: [PATCH] Merge the two Triangle Normal flavors into one code sample --- doc/glm.tex | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/doc/glm.tex b/doc/glm.tex index 8f20ff25..09acb8f3 100644 --- a/doc/glm.tex +++ b/doc/glm.tex @@ -1302,36 +1302,22 @@ Such behavior follows the precedent set by C and C++'s standard library, in that \begin{cppcode} #include // vec3 normalize cross +#include // fastNormalize -glm::vec3 computeNormal -( - glm::vec3 const & a, - glm::vec3 const & b, - glm::vec3 const & c -) +using glm::vec3; + +vec3 triNormal(vec3 const & a, vec3 const & b, vec3 const & c) { return glm::normalize(glm::cross(c - a, b - a)); } -\end{cppcode} -\begin{cppcode} // A faster (but less accurate) alternative: -#include // vec3 cross -#include // fastNormalize - -glm::vec3 computeNormal -( - glm::vec3 const & a, - glm::vec3 const & b, - glm::vec3 const & c -) +vec3 fastTriNormal(vec3 const & a, vec3 const & b, vec3 const & c) { return glm::fastNormalize(glm::cross(c - a, b - a)); } \end{cppcode} - - \subsection{Matrix Transformations} \begin{cppcode}