\doxysection{Geometry.\+h}
\hypertarget{_geometry_8h_source}{}\label{_geometry_8h_source}\index{src/Geometry.h@{src/Geometry.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00010\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00011\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_geometry}{Geometry}}\ \{}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00013\ \ \ \ \ \textcolor{keyword}{private}:}
\DoxyCodeLine{00014\ }
\DoxyCodeLine{00015\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ num\_vertices;\ }
\DoxyCodeLine{00016\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{char}\ header[81];\ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00017\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p1[4],\ p2[4],\ p3[4];\ }
\DoxyCodeLine{00018\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ norm\_x,\ norm\_y,\ norm\_z,\ norm\_mod;\ }
\DoxyCodeLine{00019\ \ \ \ \ \ \ \ \ T\ A\_ref,\ c\_ref;\ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00020\ \ \ \ \ \ \ \ \ std::vector<Matrix<T>>\ GSI\_prop;\ }
\DoxyCodeLine{00021\ \ \ \ \ \ \ \ \ std::vector<Matrix<T>>\ surface\_prop;\ }
\DoxyCodeLine{00022\ \ \ \ \ \ \ \ \ std::vector<const\ char*>\ GSI\_prop\_names;\ }
\DoxyCodeLine{00023\ \ \ \ \ \ \ \ \ std::vector<const\ char*>\ surface\_prop\_names;\ }
\DoxyCodeLine{00024\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ bounding\_box;\ \ \ }
\DoxyCodeLine{00025\ }
\DoxyCodeLine{00026\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{00027\ }
\DoxyCodeLine{00033\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_geometry_a3ecae6746e4fb148d09a26a31588dadb}{Geometry}}();}
\DoxyCodeLine{00034\ }
\DoxyCodeLine{00040\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_geometry_a3ecae6746e4fb148d09a26a31588dadb}{Geometry}}(std::string\ filename);}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00047\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_geometry_aee17ddf36f281e49813dd2d3ba620b23}{\string~Geometry}}();}
\DoxyCodeLine{00048\ }
\DoxyCodeLine{00054\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{class_geometry_afd3955430cb19adbb9ea3797e5d1ec61}{get\_num\_vertices}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ num\_vertices;\ \}}
\DoxyCodeLine{00055\ }
\DoxyCodeLine{00061\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a291554967c1c34c8e4c603736b1a89d4}{shift}}(T*\ offset);}
\DoxyCodeLine{00062\ }
\DoxyCodeLine{00068\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a291554967c1c34c8e4c603736b1a89d4}{shift}}(\mbox{\hyperlink{class_matrix}{Matrix<T>}}\ offset);}
\DoxyCodeLine{00069\ }
\DoxyCodeLine{00075\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_ad7e2894795ff250886a98adbfb4a342e}{scale}}(T\ factor);}
\DoxyCodeLine{00076\ }
\DoxyCodeLine{00083\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a195c849697e0234844c07c49ef6cac87}{rotate}}(\textcolor{keywordtype}{int}\ axis,\ T\ angle);}
\DoxyCodeLine{00084\ }
\DoxyCodeLine{00091\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a593b70236a2fe2da9c3ac9363c43dfea}{add\_GSI\_property}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}*\ property\_name,\ T\ value);}
\DoxyCodeLine{00092\ }
\DoxyCodeLine{00099\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a593b70236a2fe2da9c3ac9363c43dfea}{add\_GSI\_property}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}*\ property\_name,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ values);}
\DoxyCodeLine{00100\ }
\DoxyCodeLine{00107\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a29348287f2414cbd55f42fbc61884205}{add\_surface\_property}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}*\ property\_name,\ T\ value);}
\DoxyCodeLine{00108\ }
\DoxyCodeLine{00115\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a29348287f2414cbd55f42fbc61884205}{add\_surface\_property}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}*\ property\_name,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ values);}
\DoxyCodeLine{00116\ }
\DoxyCodeLine{00122\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_ad74e0bc682547130b4b41be31f85b0c9}{set\_A\_ref}}(T\ A\_ref)\ \{\ this-\/>A\_ref\ =\ A\_ref;\ \}}
\DoxyCodeLine{00123\ }
\DoxyCodeLine{00129\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a3c2eae1927ed7443d433fc8de3a8fba2}{set\_c\_ref}}(T\ c\_ref)\ \{\ this-\/>c\_ref\ =\ c\_ref;\ \}}
\DoxyCodeLine{00130\ }
\DoxyCodeLine{00134\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a3340f8bcbfb18a7d0b16a4f3c8cd6809}{compute\_bounding\_box}}();}
\DoxyCodeLine{00135\ }
\DoxyCodeLine{00141\ \ \ \ \ \ \ \ \ T\ \mbox{\hyperlink{class_geometry_ac5e551600ca47ba80a6eb456d760a206}{get\_A\_ref}}()\ \{\ \textcolor{keywordflow}{return}\ A\_ref;\ \}}
\DoxyCodeLine{00142\ }
\DoxyCodeLine{00148\ \ \ \ \ \ \ \ \ T\ \mbox{\hyperlink{class_geometry_a6d55f79ad40ed41cfbaec94c8201f743}{get\_c\_ref}}()\ \{\ \textcolor{keywordflow}{return}\ c\_ref;\ \}}
\DoxyCodeLine{00149\ }
\DoxyCodeLine{00156\ \ \ \ \ \ \ \ \ T\ \mbox{\hyperlink{class_geometry_acc19cfbed3a47428424c7250a0aa72f2}{compute\_area}}(\textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ index);}
\DoxyCodeLine{00157\ }
\DoxyCodeLine{00161\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a0d3d9382f0d65fec1affcd539bfa0733}{print}}();}
\DoxyCodeLine{00162\ }
\DoxyCodeLine{00163\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Getter\ methods\ for\ the\ vertex\ coordinates\ and\ normal\ vectors.}}
\DoxyCodeLine{00164\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ get\_p1\_x()\ \{\ \textcolor{keywordflow}{return}\ this-\/>p1[0];\ \}}
\DoxyCodeLine{00165\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ get\_p1\_y()\ \{\ \textcolor{keywordflow}{return}\ this-\/>p1[1];\ \}}
\DoxyCodeLine{00166\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ get\_p1\_z()\ \{\ \textcolor{keywordflow}{return}\ this-\/>p1[2];\ \}}
\DoxyCodeLine{00167\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ get\_p2\_x()\ \{\ \textcolor{keywordflow}{return}\ this-\/>p2[0];\ \}}
\DoxyCodeLine{00168\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ get\_p2\_y()\ \{\ \textcolor{keywordflow}{return}\ this-\/>p2[1];\ \}}
\DoxyCodeLine{00169\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ get\_p2\_z()\ \{\ \textcolor{keywordflow}{return}\ this-\/>p2[2];\ \}}
\DoxyCodeLine{00170\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ get\_p3\_x()\ \{\ \textcolor{keywordflow}{return}\ this-\/>p3[0];\ \}}
\DoxyCodeLine{00171\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ get\_p3\_y()\ \{\ \textcolor{keywordflow}{return}\ this-\/>p3[1];\ \}}
\DoxyCodeLine{00172\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ get\_p3\_z()\ \{\ \textcolor{keywordflow}{return}\ this-\/>p3[2];\ \}}
\DoxyCodeLine{00173\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ get\_norm\_x()\ \{\ \textcolor{keywordflow}{return}\ this-\/>norm\_x;\ \}}
\DoxyCodeLine{00174\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ get\_norm\_y()\ \{\ \textcolor{keywordflow}{return}\ this-\/>norm\_y;\ \}}
\DoxyCodeLine{00175\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ get\_norm\_z()\ \{\ \textcolor{keywordflow}{return}\ this-\/>norm\_z;\ \}}
\DoxyCodeLine{00176\ }
\DoxyCodeLine{00183\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ \mbox{\hyperlink{class_geometry_a6ba9098a3d39fddbf021df490a6abbed}{get\_GSI\_property}}(\textcolor{keywordtype}{int}\ index)\ \{\ \textcolor{keywordflow}{return}\ GSI\_prop[index];\ \}}
\DoxyCodeLine{00184\ }
\DoxyCodeLine{00191\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{char}*\ \mbox{\hyperlink{class_geometry_ac477caa4b4f34733bbe1752eaf966dcf}{get\_GSI\_property\_name}}(\textcolor{keywordtype}{int}\ index)\ \{\ \textcolor{keywordflow}{return}\ GSI\_prop\_names[index];\ \}}
\DoxyCodeLine{00192\ }
\DoxyCodeLine{00198\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ \mbox{\hyperlink{class_geometry_ab2a662ec4c2150cdb79a2ca1569f9898}{get\_bounding\_box}}();}
\DoxyCodeLine{00199\ }
\DoxyCodeLine{00205\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ \mbox{\hyperlink{class_geometry_a0a0927b0b2eb33bf9eb8f66d9114d04e}{get\_center}}();}
\DoxyCodeLine{00206\ }
\DoxyCodeLine{00212\ \ \ \ \ \ \ \ \ std::vector<Matrix<T>>\&\ \mbox{\hyperlink{class_geometry_a04f06f9115074fd95c4f66db48572c30}{get\_GSI\_properties}}()\ \{\ \textcolor{keywordflow}{return}\ GSI\_prop;\ \}}
\DoxyCodeLine{00213\ }
\DoxyCodeLine{00219\ \ \ \ \ \ \ \ \ std::vector<const\ char*>\&\ \mbox{\hyperlink{class_geometry_adf82e0a1da5d92dfefcb1ab63ea2a23c}{get\_GSI\_property\_names}}()\ \{\ \textcolor{keywordflow}{return}\ GSI\_prop\_names;\ \}}
\DoxyCodeLine{00220\ }
\DoxyCodeLine{00226\ \ \ \ \ \ \ \ \ std::vector<Matrix<T>>\&\ \mbox{\hyperlink{class_geometry_a729679f2bcc32ddd36d5b636cfdc79b6}{get\_surface\_properties}}()\ \{\ \textcolor{keywordflow}{return}\ surface\_prop;\ \}}
\DoxyCodeLine{00227\ }
\DoxyCodeLine{00233\ \ \ \ \ \ \ \ \ std::vector<const\ char*>\&\ \mbox{\hyperlink{class_geometry_a3830df67dee94fccb138a70fa52ea101}{get\_surface\_property\_names}}()\ \{\ \textcolor{keywordflow}{return}\ surface\_prop\_names;\ \}}
\DoxyCodeLine{00234\ \};}
\DoxyCodeLine{00235\ }
\DoxyCodeLine{00242\ std::ifstream\ open\_binary\_file(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}*\ filename)\ \{}
\DoxyCodeLine{00243\ \ \ \ \ \textcolor{keywordflow}{return}\ std::ifstream\{filename,\ std::ifstream::in\ |\ std::ifstream::binary\};}
\DoxyCodeLine{00244\ \}}
\DoxyCodeLine{00245\ }
\DoxyCodeLine{00253\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00254\ \textcolor{keywordtype}{char}*\ as\_char\_ptr(T*\ pointer)\ \{}
\DoxyCodeLine{00255\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{reinterpret\_cast<}\textcolor{keywordtype}{char}*\textcolor{keyword}{>}(pointer);}
\DoxyCodeLine{00256\ \}}
\DoxyCodeLine{00257\ }
\DoxyCodeLine{00265\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00266\ \textcolor{keywordtype}{void}\ read\_binary\_value(std::ifstream\&\ in,\ T*\ dst)\ \{}
\DoxyCodeLine{00267\ \ \ \ \ in.read(as\_char\_ptr(dst),\ \textcolor{keyword}{sizeof}(T));}
\DoxyCodeLine{00268\ \}}
\DoxyCodeLine{00269\ }
\DoxyCodeLine{00278\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00279\ \textcolor{keywordtype}{void}\ read\_binary\_array(std::ifstream\&\ in,\ T*\ dst,\ \textcolor{keywordtype}{size\_t}\ array\_length)\ \{}
\DoxyCodeLine{00280\ \ \ \ \ \textcolor{keywordtype}{size\_t}\ n\_bytes\ =\ array\_length\ *\ \textcolor{keyword}{sizeof}(T);}
\DoxyCodeLine{00281\ \ \ \ \ in.read(as\_char\_ptr(dst),\ n\_bytes);}
\DoxyCodeLine{00282\ \}}
\DoxyCodeLine{00283\ }
\DoxyCodeLine{00289\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00290\ \mbox{\hyperlink{class_geometry_a3ecae6746e4fb148d09a26a31588dadb}{Geometry<T>::Geometry}}()\ :\ num\_vertices(0),\ A\_ref(1.0),\ c\_ref(1.0),\ bounding\_box(6,\ 1)\ \{\}}
\DoxyCodeLine{00291\ }
\DoxyCodeLine{00300\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00301\ \mbox{\hyperlink{class_geometry_a3ecae6746e4fb148d09a26a31588dadb}{Geometry<T>::Geometry}}(std::string\ filename)\ :\ A\_ref(1.0),\ c\_ref(1.0)\ \{}
\DoxyCodeLine{00302\ }
\DoxyCodeLine{00303\ \ \ \ \ \textcolor{keywordtype}{float}\ p1\_local[4],\ p2\_local[4],\ p3\_local[4],\ normal[4];\ \textcolor{comment}{//\ Temporary\ arrays\ to\ hold\ vertex\ and\ normal\ data}}
\DoxyCodeLine{00304\ \ \ \ \ \textcolor{keywordtype}{char}\ dummy[3];\ \textcolor{comment}{//\ Dummy\ variable\ to\ skip\ unused\ bytes\ in\ the\ STL\ format}}
\DoxyCodeLine{00305\ }
\DoxyCodeLine{00306\ \ \ \ \ \textcolor{comment}{//\ Open\ the\ binary\ STL\ file}}
\DoxyCodeLine{00307\ \ \ \ \ \textcolor{keyword}{auto}\ in\ =\ open\_binary\_file(filename.c\_str());}
\DoxyCodeLine{00308\ \ \ \ \ }
\DoxyCodeLine{00309\ \ \ \ \ \textcolor{comment}{//\ Read\ the\ STL\ header\ and\ the\ number\ of\ vertices\ (triangles)}}
\DoxyCodeLine{00310\ \ \ \ \ read\_binary\_array<char>(in,\ header,\ 80);}
\DoxyCodeLine{00311\ \ \ \ \ header[80]\ =\ \textcolor{charliteral}{'\(\backslash\)0'};\ \textcolor{comment}{//\ Null-\/terminate\ the\ header\ string}}
\DoxyCodeLine{00312\ \ \ \ \ read\_binary\_value<unsigned\ int>(in,\ \&num\_vertices);}
\DoxyCodeLine{00313\ }
\DoxyCodeLine{00314\ \ \ \ \ \textcolor{comment}{//\ Initialize\ matrices\ for\ vertices\ and\ normals\ based\ on\ the\ number\ of\ triangles}}
\DoxyCodeLine{00315\ \ \ \ \ p1[0]\ =\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(1,\ num\_vertices);}
\DoxyCodeLine{00316\ \ \ \ \ p1[1]\ =\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(1,\ num\_vertices);}
\DoxyCodeLine{00317\ \ \ \ \ p1[2]\ =\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(1,\ num\_vertices);}
\DoxyCodeLine{00318\ \ \ \ \ p2[0]\ =\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(1,\ num\_vertices);}
\DoxyCodeLine{00319\ \ \ \ \ p2[1]\ =\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(1,\ num\_vertices);}
\DoxyCodeLine{00320\ \ \ \ \ p2[2]\ =\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(1,\ num\_vertices);}
\DoxyCodeLine{00321\ \ \ \ \ p3[0]\ =\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(1,\ num\_vertices);}
\DoxyCodeLine{00322\ \ \ \ \ p3[1]\ =\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(1,\ num\_vertices);}
\DoxyCodeLine{00323\ \ \ \ \ p3[2]\ =\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(1,\ num\_vertices);}
\DoxyCodeLine{00324\ }
\DoxyCodeLine{00325\ \ \ \ \ norm\_x\ =\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(1,\ num\_vertices);}
\DoxyCodeLine{00326\ \ \ \ \ norm\_y\ =\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(1,\ num\_vertices);}
\DoxyCodeLine{00327\ \ \ \ \ norm\_z\ =\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(1,\ num\_vertices);}
\DoxyCodeLine{00328\ \ \ \ \ norm\_mod\ =\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(1,\ num\_vertices);}
\DoxyCodeLine{00329\ }
\DoxyCodeLine{00330\ \ \ \ \ \textcolor{comment}{//\ Read\ the\ vertex\ and\ normal\ data\ for\ each\ triangle}}
\DoxyCodeLine{00331\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\ i\ =\ 0;\ i\ <\ num\_vertices;\ i++)\ \{}
\DoxyCodeLine{00332\ \ \ \ \ \ \ \ \ read\_binary\_array<float>(in,\ normal,\ 3);}
\DoxyCodeLine{00333\ \ \ \ \ \ \ \ \ read\_binary\_array<float>(in,\ p1\_local,\ 3);}
\DoxyCodeLine{00334\ \ \ \ \ \ \ \ \ read\_binary\_array<float>(in,\ p2\_local,\ 3);}
\DoxyCodeLine{00335\ \ \ \ \ \ \ \ \ read\_binary\_array<float>(in,\ p3\_local,\ 3);}
\DoxyCodeLine{00336\ \ \ \ \ \ \ \ \ in.read(dummy,\ 2);\ \textcolor{comment}{//\ Skip\ two\ bytes\ (STL\ format\ padding)}}
\DoxyCodeLine{00337\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00338\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Store\ the\ vertex\ and\ normal\ data\ in\ the\ respective\ matrices}}
\DoxyCodeLine{00339\ \ \ \ \ \ \ \ \ p1[0](0,\ i)\ =\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(p1\_local[0]);}
\DoxyCodeLine{00340\ \ \ \ \ \ \ \ \ p1[1](0,\ i)\ =\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(p1\_local[1]);}
\DoxyCodeLine{00341\ \ \ \ \ \ \ \ \ p1[2](0,\ i)\ =\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(p1\_local[2]);}
\DoxyCodeLine{00342\ \ \ \ \ \ \ \ \ p2[0](0,\ i)\ =\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(p2\_local[0]);}
\DoxyCodeLine{00343\ \ \ \ \ \ \ \ \ p2[1](0,\ i)\ =\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(p2\_local[1]);}
\DoxyCodeLine{00344\ \ \ \ \ \ \ \ \ p2[2](0,\ i)\ =\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(p2\_local[2]);}
\DoxyCodeLine{00345\ \ \ \ \ \ \ \ \ p3[0](0,\ i)\ =\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(p3\_local[0]);}
\DoxyCodeLine{00346\ \ \ \ \ \ \ \ \ p3[1](0,\ i)\ =\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(p3\_local[1]);}
\DoxyCodeLine{00347\ \ \ \ \ \ \ \ \ p3[2](0,\ i)\ =\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(p3\_local[2]);}
\DoxyCodeLine{00348\ }
\DoxyCodeLine{00349\ \ \ \ \ \ \ \ \ norm\_x(0,\ i)\ =\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(normal[0]);}
\DoxyCodeLine{00350\ \ \ \ \ \ \ \ \ norm\_y(0,\ i)\ =\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(normal[1]);}
\DoxyCodeLine{00351\ \ \ \ \ \ \ \ \ norm\_z(0,\ i)\ =\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(normal[2]);}
\DoxyCodeLine{00352\ }
\DoxyCodeLine{00353\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Calculate\ the\ magnitude\ of\ the\ normal\ vector\ and\ normalize\ it}}
\DoxyCodeLine{00354\ \ \ \ \ \ \ \ \ norm\_mod(0,\ i)\ =\ std::sqrt(norm\_x(0,\ i)\ *\ norm\_x(0,\ i)\ +\ norm\_y(0,\ i)\ *\ norm\_y(0,\ i)\ +\ norm\_z(0,\ i)\ *\ norm\_z(0,\ i));}
\DoxyCodeLine{00355\ \ \ \ \ \ \ \ \ norm\_x(0,\ i)\ /=\ norm\_mod(0,\ i);}
\DoxyCodeLine{00356\ \ \ \ \ \ \ \ \ norm\_y(0,\ i)\ /=\ norm\_mod(0,\ i);}
\DoxyCodeLine{00357\ \ \ \ \ \ \ \ \ norm\_z(0,\ i)\ /=\ norm\_mod(0,\ i);}
\DoxyCodeLine{00358\ \ \ \ \ \}}
\DoxyCodeLine{00359\ }
\DoxyCodeLine{00360\ \ \ \ \ \textcolor{comment}{//\ Compute\ the\ bounding\ box\ for\ the\ geometry}}
\DoxyCodeLine{00361\ \ \ \ \ \mbox{\hyperlink{class_geometry_a3340f8bcbfb18a7d0b16a4f3c8cd6809}{compute\_bounding\_box}}();}
\DoxyCodeLine{00362\ \}}
\DoxyCodeLine{00363\ }
\DoxyCodeLine{00369\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00370\ \mbox{\hyperlink{class_geometry_aee17ddf36f281e49813dd2d3ba620b23}{Geometry<T>::\string~Geometry}}()\ \{}
\DoxyCodeLine{00371\ \ \ \ \ num\_vertices\ =\ 0;}
\DoxyCodeLine{00372\ \}}
\DoxyCodeLine{00373\ }
\DoxyCodeLine{00380\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00381\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a3340f8bcbfb18a7d0b16a4f3c8cd6809}{Geometry<T>::compute\_bounding\_box}}()\ \{}
\DoxyCodeLine{00382\ \ \ \ \ this-\/>bounding\_box\ =\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}(6,\ 1);}
\DoxyCodeLine{00383\ \ \ \ \ T\ bb\_x\_1,\ bb\_x\_2,\ bb\_y\_1,\ bb\_y\_2,\ bb\_z\_1,\ bb\_z\_2;}
\DoxyCodeLine{00384\ }
\DoxyCodeLine{00385\ \ \ \ \ \textcolor{comment}{//\ Compute\ the\ min\ and\ max\ values\ for\ each\ dimension\ (x,\ y,\ z)}}
\DoxyCodeLine{00386\ \ \ \ \ bb\_x\_1\ =\ std::min(p1[0].min(),\ std::min(p2[0].min(),\ p3[0].min()));}
\DoxyCodeLine{00387\ \ \ \ \ bb\_x\_2\ =\ std::max(p1[0].max(),\ std::max(p2[0].max(),\ p3[0].max()));}
\DoxyCodeLine{00388\ \ \ \ \ bb\_y\_1\ =\ std::min(p1[1].min(),\ std::min(p2[1].min(),\ p3[1].min()));}
\DoxyCodeLine{00389\ \ \ \ \ bb\_y\_2\ =\ std::max(p1[1].max(),\ std::max(p2[1].max(),\ p3[1].max()));}
\DoxyCodeLine{00390\ \ \ \ \ bb\_z\_1\ =\ std::min(p1[2].min(),\ std::min(p2[2].min(),\ p3[2].min()));}
\DoxyCodeLine{00391\ \ \ \ \ bb\_z\_2\ =\ std::max(p1[2].max(),\ std::max(p2[2].max(),\ p3[2].max()));}
\DoxyCodeLine{00392\ }
\DoxyCodeLine{00393\ \ \ \ \ \textcolor{comment}{//\ Store\ the\ bounding\ box\ values}}
\DoxyCodeLine{00394\ \ \ \ \ bounding\_box(0,\ 0)\ =\ bb\_x\_1;}
\DoxyCodeLine{00395\ \ \ \ \ bounding\_box(1,\ 0)\ =\ bb\_x\_2;}
\DoxyCodeLine{00396\ \ \ \ \ bounding\_box(2,\ 0)\ =\ bb\_y\_1;}
\DoxyCodeLine{00397\ \ \ \ \ bounding\_box(3,\ 0)\ =\ bb\_y\_2;}
\DoxyCodeLine{00398\ \ \ \ \ bounding\_box(4,\ 0)\ =\ bb\_z\_1;}
\DoxyCodeLine{00399\ \ \ \ \ bounding\_box(5,\ 0)\ =\ bb\_z\_2;}
\DoxyCodeLine{00400\ \}}
\DoxyCodeLine{00401\ }
\DoxyCodeLine{00407\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00408\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ \mbox{\hyperlink{class_geometry_a0a0927b0b2eb33bf9eb8f66d9114d04e}{Geometry<T>::get\_center}}()\ \{}
\DoxyCodeLine{00409\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ center(3,\ 1);}
\DoxyCodeLine{00410\ }
\DoxyCodeLine{00411\ \ \ \ \ \textcolor{comment}{//\ Calculate\ the\ center\ point\ by\ averaging\ the\ min\ and\ max\ coordinates\ in\ each\ dimension}}
\DoxyCodeLine{00412\ \ \ \ \ center(0)\ =\ (bounding\_box(0,\ 0)\ +\ bounding\_box(1,\ 0))\ /\ 2.0;}
\DoxyCodeLine{00413\ \ \ \ \ center(1)\ =\ (bounding\_box(3,\ 0)\ +\ bounding\_box(2,\ 0))\ /\ 2.0;}
\DoxyCodeLine{00414\ \ \ \ \ center(2)\ =\ (bounding\_box(5,\ 0)\ +\ bounding\_box(4,\ 0))\ /\ 2.0;}
\DoxyCodeLine{00415\ }
\DoxyCodeLine{00416\ \ \ \ \ \textcolor{keywordflow}{return}\ center;}
\DoxyCodeLine{00417\ \}}
\DoxyCodeLine{00418\ }
\DoxyCodeLine{00427\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00428\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a291554967c1c34c8e4c603736b1a89d4}{Geometry<T>::shift}}(T*\ offset)\ \{}
\DoxyCodeLine{00429\ \ \ \ \ \textcolor{comment}{//\ Shift\ all\ vertices\ by\ the\ specified\ offset\ in\ x,\ y,\ and\ z\ directions.}}
\DoxyCodeLine{00430\ \ \ \ \ p1[0]\ +=\ offset[0];}
\DoxyCodeLine{00431\ \ \ \ \ p1[1]\ +=\ offset[1];}
\DoxyCodeLine{00432\ \ \ \ \ p1[2]\ +=\ offset[2];}
\DoxyCodeLine{00433\ }
\DoxyCodeLine{00434\ \ \ \ \ p2[0]\ +=\ offset[0];}
\DoxyCodeLine{00435\ \ \ \ \ p2[1]\ +=\ offset[1];}
\DoxyCodeLine{00436\ \ \ \ \ p2[2]\ +=\ offset[2];}
\DoxyCodeLine{00437\ }
\DoxyCodeLine{00438\ \ \ \ \ p3[0]\ +=\ offset[0];}
\DoxyCodeLine{00439\ \ \ \ \ p3[1]\ +=\ offset[1];}
\DoxyCodeLine{00440\ \ \ \ \ p3[2]\ +=\ offset[2];}
\DoxyCodeLine{00441\ }
\DoxyCodeLine{00442\ \ \ \ \ \textcolor{comment}{//\ Update\ bounding\ box\ by\ adding\ offset\ to\ each\ corresponding\ dimension.}}
\DoxyCodeLine{00443\ \ \ \ \ bounding\_box(0,\ 0)\ +=\ offset[0];}
\DoxyCodeLine{00444\ \ \ \ \ bounding\_box(1,\ 0)\ +=\ offset[0];}
\DoxyCodeLine{00445\ \ \ \ \ bounding\_box(2,\ 0)\ +=\ offset[1];}
\DoxyCodeLine{00446\ \ \ \ \ bounding\_box(3,\ 0)\ +=\ offset[1];}
\DoxyCodeLine{00447\ \ \ \ \ bounding\_box(4,\ 0)\ +=\ offset[2];}
\DoxyCodeLine{00448\ \ \ \ \ bounding\_box(5,\ 0)\ +=\ offset[2];}
\DoxyCodeLine{00449\ \}}
\DoxyCodeLine{00450\ }
\DoxyCodeLine{00459\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00460\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a291554967c1c34c8e4c603736b1a89d4}{Geometry<T>::shift}}(\mbox{\hyperlink{class_matrix}{Matrix<T>}}\ offset)\ \{}
\DoxyCodeLine{00461\ \ \ \ \ \textcolor{comment}{//\ Shift\ all\ vertices\ by\ the\ offset\ Matrix\ values\ in\ x,\ y,\ and\ z\ directions.}}
\DoxyCodeLine{00462\ \ \ \ \ p1[0]\ +=\ offset(0);}
\DoxyCodeLine{00463\ \ \ \ \ p1[1]\ +=\ offset(1);}
\DoxyCodeLine{00464\ \ \ \ \ p1[2]\ +=\ offset(2);}
\DoxyCodeLine{00465\ }
\DoxyCodeLine{00466\ \ \ \ \ p2[0]\ +=\ offset(0);}
\DoxyCodeLine{00467\ \ \ \ \ p2[1]\ +=\ offset(1);}
\DoxyCodeLine{00468\ \ \ \ \ p2[2]\ +=\ offset(2);}
\DoxyCodeLine{00469\ }
\DoxyCodeLine{00470\ \ \ \ \ p3[0]\ +=\ offset(0);}
\DoxyCodeLine{00471\ \ \ \ \ p3[1]\ +=\ offset(1);}
\DoxyCodeLine{00472\ \ \ \ \ p3[2]\ +=\ offset(2);}
\DoxyCodeLine{00473\ }
\DoxyCodeLine{00474\ \ \ \ \ \textcolor{comment}{//\ Update\ bounding\ box\ by\ adding\ offset\ to\ each\ corresponding\ dimension.}}
\DoxyCodeLine{00475\ \ \ \ \ bounding\_box(0,\ 0)\ +=\ offset(0);}
\DoxyCodeLine{00476\ \ \ \ \ bounding\_box(1,\ 0)\ +=\ offset(0);}
\DoxyCodeLine{00477\ \ \ \ \ bounding\_box(2,\ 0)\ +=\ offset(1);}
\DoxyCodeLine{00478\ \ \ \ \ bounding\_box(3,\ 0)\ +=\ offset(1);}
\DoxyCodeLine{00479\ \ \ \ \ bounding\_box(4,\ 0)\ +=\ offset(2);}
\DoxyCodeLine{00480\ \ \ \ \ bounding\_box(5,\ 0)\ +=\ offset(2);}
\DoxyCodeLine{00481\ \}}
\DoxyCodeLine{00482\ }
\DoxyCodeLine{00490\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00491\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_ad7e2894795ff250886a98adbfb4a342e}{Geometry<T>::scale}}(T\ factor)\ \{}
\DoxyCodeLine{00492\ \ \ \ \ \textcolor{comment}{//\ Scale\ all\ vertices\ by\ the\ given\ factor.}}
\DoxyCodeLine{00493\ \ \ \ \ p1[0]\ *=\ factor;}
\DoxyCodeLine{00494\ \ \ \ \ p1[1]\ *=\ factor;}
\DoxyCodeLine{00495\ \ \ \ \ p1[2]\ *=\ factor;}
\DoxyCodeLine{00496\ }
\DoxyCodeLine{00497\ \ \ \ \ p2[0]\ *=\ factor;}
\DoxyCodeLine{00498\ \ \ \ \ p2[1]\ *=\ factor;}
\DoxyCodeLine{00499\ \ \ \ \ p2[2]\ *=\ factor;}
\DoxyCodeLine{00500\ }
\DoxyCodeLine{00501\ \ \ \ \ p3[0]\ *=\ factor;}
\DoxyCodeLine{00502\ \ \ \ \ p3[1]\ *=\ factor;}
\DoxyCodeLine{00503\ \ \ \ \ p3[2]\ *=\ factor;}
\DoxyCodeLine{00504\ }
\DoxyCodeLine{00505\ \ \ \ \ \textcolor{comment}{//\ Scale\ the\ bounding\ box\ by\ the\ given\ factor.}}
\DoxyCodeLine{00506\ \ \ \ \ bounding\_box\ *=\ factor;}
\DoxyCodeLine{00507\ \}}
\DoxyCodeLine{00508\ }
\DoxyCodeLine{00518\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00519\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a195c849697e0234844c07c49ef6cac87}{Geometry<T>::rotate}}(\textcolor{keywordtype}{int}\ axis,\ T\ angle)\ \{}
\DoxyCodeLine{00520\ \ \ \ \ \textcolor{keywordflow}{if}\ (axis\ ==\ 0)\ \{}
\DoxyCodeLine{00521\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Rotation\ around\ the\ x-\/axis}}
\DoxyCodeLine{00522\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p1\_y\_new\ =\ (p1[1]\ *\ cos(angle)\ +\ p1[2]\ *\ sin(angle));}
\DoxyCodeLine{00523\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p1\_z\_new\ =\ (p1[2]\ *\ cos(angle)\ -\/\ p1[1]\ *\ sin(angle));}
\DoxyCodeLine{00524\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p2\_y\_new\ =\ (p2[1]\ *\ cos(angle)\ +\ p2[2]\ *\ sin(angle));}
\DoxyCodeLine{00525\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p2\_z\_new\ =\ (p2[2]\ *\ cos(angle)\ -\/\ p2[1]\ *\ sin(angle));}
\DoxyCodeLine{00526\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p3\_y\_new\ =\ (p3[1]\ *\ cos(angle)\ +\ p3[2]\ *\ sin(angle));}
\DoxyCodeLine{00527\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p3\_z\_new\ =\ (p3[2]\ *\ cos(angle)\ -\/\ p3[1]\ *\ sin(angle));}
\DoxyCodeLine{00528\ }
\DoxyCodeLine{00529\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ norm\_y\_new\ =\ norm\_y\ *\ cos(angle)\ +\ norm\_z\ *\ sin(angle);}
\DoxyCodeLine{00530\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ norm\_z\_new\ =\ norm\_z\ *\ cos(angle)\ -\/\ norm\_y\ *\ sin(angle);}
\DoxyCodeLine{00531\ }
\DoxyCodeLine{00532\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Update\ vertices\ and\ normals\ after\ the\ rotation.}}
\DoxyCodeLine{00533\ \ \ \ \ \ \ \ \ p1[1]\ =\ p1\_y\_new;\ p1[2]\ =\ p1\_z\_new;}
\DoxyCodeLine{00534\ \ \ \ \ \ \ \ \ p2[1]\ =\ p2\_y\_new;\ p2[2]\ =\ p2\_z\_new;}
\DoxyCodeLine{00535\ \ \ \ \ \ \ \ \ p3[1]\ =\ p3\_y\_new;\ p3[2]\ =\ p3\_z\_new;}
\DoxyCodeLine{00536\ \ \ \ \ \ \ \ \ norm\_y\ =\ norm\_y\_new;\ norm\_z\ =\ norm\_z\_new;}
\DoxyCodeLine{00537\ }
\DoxyCodeLine{00538\ \ \ \ \ \ \ \ \ compute\_bounding\_box();\ \textcolor{comment}{//\ Recompute\ the\ bounding\ box\ after\ rotation.}}
\DoxyCodeLine{00539\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (axis\ ==\ 1)\ \{}
\DoxyCodeLine{00540\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Rotation\ around\ the\ y-\/axis}}
\DoxyCodeLine{00541\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p1\_x\_new\ =\ p1[0]\ *\ cos(angle)\ -\/\ p1[2]\ *\ sin(angle);}
\DoxyCodeLine{00542\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p1\_z\_new\ =\ p1[0]\ *\ sin(angle)\ +\ p1[2]\ *\ cos(angle);}
\DoxyCodeLine{00543\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p2\_x\_new\ =\ p2[0]\ *\ cos(angle)\ -\/\ p2[2]\ *\ sin(angle);}
\DoxyCodeLine{00544\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p2\_z\_new\ =\ p2[0]\ *\ sin(angle)\ +\ p2[2]\ *\ cos(angle);}
\DoxyCodeLine{00545\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p3\_x\_new\ =\ p3[0]\ *\ cos(angle)\ -\/\ p3[2]\ *\ sin(angle);}
\DoxyCodeLine{00546\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p3\_z\_new\ =\ p3[0]\ *\ sin(angle)\ +\ p3[2]\ *\ cos(angle);}
\DoxyCodeLine{00547\ }
\DoxyCodeLine{00548\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ norm\_x\_new\ =\ (norm\_x\ *\ cos(angle)\ -\/\ norm\_z\ *\ sin(angle));}
\DoxyCodeLine{00549\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ norm\_z\_new\ =\ (norm\_x\ *\ sin(angle)\ +\ norm\_z\ *\ cos(angle));}
\DoxyCodeLine{00550\ }
\DoxyCodeLine{00551\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Update\ vertices\ and\ normals\ after\ the\ rotation.}}
\DoxyCodeLine{00552\ \ \ \ \ \ \ \ \ p1[0]\ =\ p1\_x\_new;\ p1[2]\ =\ p1\_z\_new;}
\DoxyCodeLine{00553\ \ \ \ \ \ \ \ \ p2[0]\ =\ p2\_x\_new;\ p2[2]\ =\ p2\_z\_new;}
\DoxyCodeLine{00554\ \ \ \ \ \ \ \ \ p3[0]\ =\ p3\_x\_new;\ p3[2]\ =\ p3\_z\_new;}
\DoxyCodeLine{00555\ \ \ \ \ \ \ \ \ norm\_x\ =\ norm\_x\_new;\ norm\_z\ =\ norm\_z\_new;}
\DoxyCodeLine{00556\ }
\DoxyCodeLine{00557\ \ \ \ \ \ \ \ \ compute\_bounding\_box();\ \textcolor{comment}{//\ Recompute\ the\ bounding\ box\ after\ rotation.}}
\DoxyCodeLine{00558\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (axis\ ==\ 2)\ \{}
\DoxyCodeLine{00559\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Rotation\ around\ the\ z-\/axis}}
\DoxyCodeLine{00560\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p1\_x\_new\ =\ p1[0]\ *\ cos(angle)\ +\ p1[1]\ *\ sin(angle);}
\DoxyCodeLine{00561\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p1\_y\_new\ =\ p1[1]\ *\ cos(angle)\ -\/\ p1[0]\ *\ sin(angle);}
\DoxyCodeLine{00562\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p2\_x\_new\ =\ p2[0]\ *\ cos(angle)\ +\ p2[1]\ *\ sin(angle);}
\DoxyCodeLine{00563\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p2\_y\_new\ =\ p2[1]\ *\ cos(angle)\ -\/\ p2[0]\ *\ sin(angle);}
\DoxyCodeLine{00564\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p3\_x\_new\ =\ p3[0]\ *\ cos(angle)\ +\ p3[1]\ *\ sin(angle);}
\DoxyCodeLine{00565\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ p3\_y\_new\ =\ p3[1]\ *\ cos(angle)\ -\/\ p3[0]\ *\ sin(angle);}
\DoxyCodeLine{00566\ }
\DoxyCodeLine{00567\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ norm\_x\_new\ =\ norm\_x\ *\ cos(angle)\ +\ norm\_y\ *\ sin(angle);}
\DoxyCodeLine{00568\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ norm\_y\_new\ =\ norm\_y\ *\ cos(angle)\ -\/\ norm\_x\ *\ sin(angle);}
\DoxyCodeLine{00569\ }
\DoxyCodeLine{00570\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Update\ vertices\ and\ normals\ after\ the\ rotation.}}
\DoxyCodeLine{00571\ \ \ \ \ \ \ \ \ p1[0]\ =\ p1\_x\_new;\ p1[1]\ =\ p1\_y\_new;}
\DoxyCodeLine{00572\ \ \ \ \ \ \ \ \ p2[0]\ =\ p2\_x\_new;\ p2[1]\ =\ p2\_y\_new;}
\DoxyCodeLine{00573\ \ \ \ \ \ \ \ \ p3[0]\ =\ p3\_x\_new;\ p3[1]\ =\ p3\_y\_new;}
\DoxyCodeLine{00574\ \ \ \ \ \ \ \ \ norm\_x\ =\ norm\_x\_new;\ norm\_y\ =\ norm\_y\_new;}
\DoxyCodeLine{00575\ }
\DoxyCodeLine{00576\ \ \ \ \ \ \ \ \ compute\_bounding\_box();\ \textcolor{comment}{//\ Recompute\ the\ bounding\ box\ after\ rotation.}}
\DoxyCodeLine{00577\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00578\ \ \ \ \ \ \ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}The\ axis\ must\ be\ either\ 0,\ 1,\ or\ 2!\(\backslash\)n"{}};}
\DoxyCodeLine{00579\ \ \ \ \ \}}
\DoxyCodeLine{00580\ \}}
\DoxyCodeLine{00581\ }
\DoxyCodeLine{00590\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00591\ T\ \mbox{\hyperlink{class_geometry_acc19cfbed3a47428424c7250a0aa72f2}{Geometry<T>::compute\_area}}(\textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ index)\ \{}
\DoxyCodeLine{00592\ \ \ \ \ \textcolor{keywordflow}{return}\ 0.5\ *\ fabs(p1[0](index)\ *\ (p2[1](index)\ *\ p3[2](index)\ -\/\ p3[1](index)\ *\ p2[2](index))\ +\ }
\DoxyCodeLine{00593\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ p1[1](index)\ *\ (p3[0](index)\ *\ p2[2](index)\ -\/\ p2[0](index)\ *\ p3[2](index))\ +\ }
\DoxyCodeLine{00594\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ p1[2](index)\ *\ (p2[0](index)\ *\ p3[1](index)\ -\/\ p3[0](index)\ *\ p2[1](index)));}
\DoxyCodeLine{00595\ \}}
\DoxyCodeLine{00596\ }
\DoxyCodeLine{00605\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00606\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a593b70236a2fe2da9c3ac9363c43dfea}{Geometry<T>::add\_GSI\_property}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}*\ property\_name,\ T\ value)\ \{}
\DoxyCodeLine{00607\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ property(1,\ num\_vertices);}
\DoxyCodeLine{00608\ \ \ \ \ \textcolor{keyword}{property}\ +=\ value;}
\DoxyCodeLine{00609\ \ \ \ \ GSI\_prop.push\_back(property);}
\DoxyCodeLine{00610\ \ \ \ \ GSI\_prop\_names.push\_back(property\_name);}
\DoxyCodeLine{00611\ \}}
\DoxyCodeLine{00612\ }
\DoxyCodeLine{00621\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00622\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a593b70236a2fe2da9c3ac9363c43dfea}{Geometry<T>::add\_GSI\_property}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}*\ property\_name,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ values)\ \{}
\DoxyCodeLine{00623\ \ \ \ \ GSI\_prop.push\_back(values);}
\DoxyCodeLine{00624\ \ \ \ \ GSI\_prop\_names.push\_back(property\_name);}
\DoxyCodeLine{00625\ \}}
\DoxyCodeLine{00626\ }
\DoxyCodeLine{00635\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00636\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a29348287f2414cbd55f42fbc61884205}{Geometry<T>::add\_surface\_property}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}*\ property\_name,\ T\ value)\ \{}
\DoxyCodeLine{00637\ \ \ \ \ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ property(1,\ num\_vertices);}
\DoxyCodeLine{00638\ \ \ \ \ \textcolor{keyword}{property}\ +=\ value;}
\DoxyCodeLine{00639\ \ \ \ \ surface\_prop.push\_back(property);}
\DoxyCodeLine{00640\ \ \ \ \ surface\_prop\_names.push\_back(property\_name);}
\DoxyCodeLine{00641\ \}}
\DoxyCodeLine{00642\ }
\DoxyCodeLine{00651\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00652\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a29348287f2414cbd55f42fbc61884205}{Geometry<T>::add\_surface\_property}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}*\ property\_name,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\&\ values)\ \{}
\DoxyCodeLine{00653\ \ \ \ \ surface\_prop.push\_back(values);}
\DoxyCodeLine{00654\ \ \ \ \ surface\_prop\_names.push\_back(property\_name);}
\DoxyCodeLine{00655\ \}}
\DoxyCodeLine{00656\ }
\DoxyCodeLine{00663\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00664\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_geometry_a0d3d9382f0d65fec1affcd539bfa0733}{Geometry<T>::print}}()\ \{}
\DoxyCodeLine{00665\ \ \ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}STL\ file\ with\ "{}}\ <<\ num\_vertices\ <<\ \textcolor{stringliteral}{"{}\ triangles:\(\backslash\)n\(\backslash\)n"{}};}
\DoxyCodeLine{00666\ }
\DoxyCodeLine{00667\ \ \ \ \ \textcolor{comment}{//\ Loop\ through\ each\ triangle\ and\ print\ its\ details}}
\DoxyCodeLine{00668\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\ i\ =\ 0;\ i\ <\ num\_vertices;\ i++)\ \{}
\DoxyCodeLine{00669\ \ \ \ \ \ \ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}Triangle\ "{}}\ <<\ i\ <<\ \textcolor{stringliteral}{"{}:\(\backslash\)n"{}};}
\DoxyCodeLine{00670\ \ \ \ \ \ \ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}p1:\ ["{}}\ <<\ p1[0](i)\ <<\ \textcolor{stringliteral}{"{}\ "{}}\ <<\ p1[1](i)\ <<\ \textcolor{stringliteral}{"{}\ "{}}\ <<\ p1[2](i)\ <<\ \textcolor{stringliteral}{"{}]\(\backslash\)n"{}};}
\DoxyCodeLine{00671\ \ \ \ \ \ \ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}p2:\ ["{}}\ <<\ p2[0](i)\ <<\ \textcolor{stringliteral}{"{}\ "{}}\ <<\ p2[1](i)\ <<\ \textcolor{stringliteral}{"{}\ "{}}\ <<\ p2[2](i)\ <<\ \textcolor{stringliteral}{"{}]\(\backslash\)n"{}};}
\DoxyCodeLine{00672\ \ \ \ \ \ \ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}p3:\ ["{}}\ <<\ p3[0](i)\ <<\ \textcolor{stringliteral}{"{}\ "{}}\ <<\ p3[1](i)\ <<\ \textcolor{stringliteral}{"{}\ "{}}\ <<\ p3[2](i)\ <<\ \textcolor{stringliteral}{"{}]\(\backslash\)n"{}};}
\DoxyCodeLine{00673\ }
\DoxyCodeLine{00674\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Print\ the\ normal\ vector\ of\ the\ triangle}}
\DoxyCodeLine{00675\ \ \ \ \ \ \ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}normal:\ ["{}}\ <<\ norm\_x(i)\ <<\ \textcolor{stringliteral}{"{}\ "{}}\ <<\ norm\_y(i)\ <<\ \textcolor{stringliteral}{"{}\ "{}}\ <<\ norm\_z(i)\ <<\ \textcolor{stringliteral}{"{}]\(\backslash\)n"{}};}
\DoxyCodeLine{00676\ }
\DoxyCodeLine{00677\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Print\ the\ names\ of\ GSI\ properties}}
\DoxyCodeLine{00678\ \ \ \ \ \ \ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}GSI\ properties\ names:\ "{}};}
\DoxyCodeLine{00679\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\ j\ =\ 0;\ j\ <\ GSI\_prop\_names.size();\ j++)\ \{}
\DoxyCodeLine{00680\ \ \ \ \ \ \ \ \ \ \ \ \ std::cout\ <<\ GSI\_prop\_names[j]\ <<\ \textcolor{stringliteral}{"{}\ "{}};}
\DoxyCodeLine{00681\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00682\ }
\DoxyCodeLine{00683\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Print\ the\ values\ of\ GSI\ properties\ for\ the\ current\ triangle}}
\DoxyCodeLine{00684\ \ \ \ \ \ \ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)nGSI\ properties\ values:\ "{}};}
\DoxyCodeLine{00685\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\ j\ =\ 0;\ j\ <\ GSI\_prop.size();\ j++)\ \{}
\DoxyCodeLine{00686\ \ \ \ \ \ \ \ \ \ \ \ \ std::cout\ <<\ GSI\_prop[j](i)\ <<\ \textcolor{stringliteral}{"{}\ "{}};}
\DoxyCodeLine{00687\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00688\ }
\DoxyCodeLine{00689\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Print\ the\ names\ of\ surface\ properties}}
\DoxyCodeLine{00690\ \ \ \ \ \ \ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)nSurface\ properties\ names:\ "{}};}
\DoxyCodeLine{00691\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\ j\ =\ 0;\ j\ <\ surface\_prop\_names.size();\ j++)\ \{}
\DoxyCodeLine{00692\ \ \ \ \ \ \ \ \ \ \ \ \ std::cout\ <<\ surface\_prop\_names[j]\ <<\ \textcolor{stringliteral}{"{}\ "{}};}
\DoxyCodeLine{00693\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00694\ }
\DoxyCodeLine{00695\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Print\ the\ values\ of\ surface\ properties\ for\ the\ current\ triangle}}
\DoxyCodeLine{00696\ \ \ \ \ \ \ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)nSurface\ properties\ values:\ "{}};}
\DoxyCodeLine{00697\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\ j\ =\ 0;\ j\ <\ surface\_prop.size();\ j++)\ \{}
\DoxyCodeLine{00698\ \ \ \ \ \ \ \ \ \ \ \ \ std::cout\ <<\ surface\_prop[j](i)\ <<\ \textcolor{stringliteral}{"{}\ "{}};}
\DoxyCodeLine{00699\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00700\ \ \ \ \ \ \ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)n\(\backslash\)n"{}};}
\DoxyCodeLine{00701\ \ \ \ \ \}}
\DoxyCodeLine{00702\ \}}
\DoxyCodeLine{00703\ }
\DoxyCodeLine{00711\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00712\ \mbox{\hyperlink{class_matrix}{Matrix<T>}}\ \mbox{\hyperlink{class_geometry_ab2a662ec4c2150cdb79a2ca1569f9898}{Geometry<T>::get\_bounding\_box}}()\ \{}
\DoxyCodeLine{00713\ \ \ \ \ \textcolor{keywordflow}{return}\ bounding\_box;}
\DoxyCodeLine{00714\ \}}

\end{DoxyCode}
