\doxysection{IPoint3.\+hpp}
\hypertarget{IPoint3_8hpp_source}{}\label{IPoint3_8hpp_source}\index{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/Math/IPoint3.hpp@{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/Math/IPoint3.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#ifndef\ GYM\_PCB\_MATH\_IPOINT3\_H}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#define\ GYM\_PCB\_MATH\_IPOINT3\_H}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ "{}Math/IPoint2.hpp"{}}}
\DoxyCodeLine{00006\ }
\DoxyCodeLine{00007\ \textcolor{keyword}{class\ }IVector\_3}
\DoxyCodeLine{00008\ \{}
\DoxyCodeLine{00009\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00010\ \ \ \ \ int32\_t\ x,\ y,\ z;}
\DoxyCodeLine{00011\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00012\ \ \ \ \ IVector\_3()\ \{\ \}}
\DoxyCodeLine{00013\ \ \ \ \ IVector\_3(\textcolor{keywordtype}{int}\ X,\ \textcolor{keywordtype}{int}\ Y,\ \textcolor{keywordtype}{int}\ Z)\ :\ x(X),\ y(Y),\ z(Z)\ \{\ \}}
\DoxyCodeLine{00014\ \ \ \ \ IVector\_3(\textcolor{keyword}{const}\ \mbox{\hyperlink{classIVector__2}{IVector\_2}}\ \&v,\ \textcolor{keywordtype}{int}\ Z)\ :\ x(v.x),\ y(v.y),\ z(Z)\ \{\ \}}
\DoxyCodeLine{00015\ \ \ \ \ IVector\_3(\textcolor{keyword}{const}\ IVector\_3\ \&v)\ :\ x(v.x),\ y(v.y),\ z(v.z)\ \{\ \}}
\DoxyCodeLine{00016\ \ \ \ \ IVector\_3\&\ operator=(\textcolor{keyword}{const}\ IVector\_3\ \&v)\ \{\ x\ =\ v.x;\ y\ =\ v.y;\ z\ =\ v.z;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00017\ \ \ \ \ \textcolor{keywordtype}{bool}\ operator==(\textcolor{keyword}{const}\ IVector\_3\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x\ ==\ v.x\ \&\&\ y\ ==\ v.y\ \&\&\ z\ ==\ v.z;\ \}}
\DoxyCodeLine{00018\ \ \ \ \ \textcolor{keywordtype}{bool}\ operator!=(\textcolor{keyword}{const}\ IVector\_3\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x\ !=\ v.x\ ||\ y\ !=\ v.y\ ||\ z\ !=\ v.z;\ \}}
\DoxyCodeLine{00019\ \ \ \ \ IVector\_3\ operator+(\textcolor{keyword}{const}\ IVector\_3\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IVector\_3(x\ +\ v.x,\ y\ +\ v.y,\ z\ +\ v.z);\ \}}
\DoxyCodeLine{00020\ \ \ \ \ IVector\_3\ operator-\/(\textcolor{keyword}{const}\ IVector\_3\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IVector\_3(x\ -\/\ v.x,\ y\ -\/\ v.y,\ z\ -\/\ v.z);\ \}}
\DoxyCodeLine{00021\ \ \ \ \ IVector\_3\ operator*(\textcolor{keywordtype}{int}\ s)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IVector\_3(x\ *\ s,\ y\ *\ s,\ z\ *\ s);\ \}}
\DoxyCodeLine{00022\ \ \ \ \ IVector\_3\ operator/(\textcolor{keywordtype}{int}\ s)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IVector\_3((x\ +\ s\ -\/\ 1)\ /\ s,\ (y\ +\ s\ -\/\ 1)\ /\ s,\ (z\ +\ s\ -\/\ 1)\ /\ s);\ \}}
\DoxyCodeLine{00023\ \ \ \ \ IVector\_3\&\ operator+=(\textcolor{keyword}{const}\ IVector\_3\ \&v)\ \{\ x\ +=\ v.x;\ y\ +=\ v.y;\ z\ +=\ v.z;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00024\ \ \ \ \ IVector\_3\&\ operator-\/=(\textcolor{keyword}{const}\ IVector\_3\ \&v)\ \{\ x\ -\/=\ v.x;\ y\ -\/=\ v.y;\ z\ -\/=\ v.z;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00025\ \ \ \ \ IVector\_3\&\ operator*=(\textcolor{keywordtype}{int}\ s)\ \{\ *\textcolor{keyword}{this}\ =\ *\textcolor{keyword}{this}\ *\ s;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00026\ \ \ \ \ IVector\_3\&\ operator/=(\textcolor{keywordtype}{int}\ s)\ \{\ *\textcolor{keyword}{this}\ =\ *\textcolor{keyword}{this}\ /\ s;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00027\ \ \ \ \ IVector\_3\ abs()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IVector\_3(std::abs(x),\ std::abs(y),\ std::abs(z));\ \}}
\DoxyCodeLine{00028\ \ \ \ \ int32\_t\ dot(\textcolor{keyword}{const}\ IVector\_3\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x\ *\ v.x\ +\ y\ *\ v.y\ +\ z\ *\ v.z;\ \}}
\DoxyCodeLine{00029\ \ \ \ \ int32\_t\ norm1()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ std::abs(x)\ +\ std::abs(y)\ +\ std::abs(z);\ \}}
\DoxyCodeLine{00030\ \ \ \ \ int32\_t\ hprod()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x\ *\ y\ *\ z;\ \}}
\DoxyCodeLine{00031\ \ \ \ \ IVector\_3\ max\_cw(\textcolor{keyword}{const}\ IVector\_3\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IVector\_3(std::max(x,\ v.x),\ std::max(y,\ v.y),\ std::max(z,\ v.z));\ \}}
\DoxyCodeLine{00032\ \ \ \ \ IVector\_3\ min\_cw(\textcolor{keyword}{const}\ IVector\_3\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IVector\_3(std::min(x,\ v.x),\ std::min(y,\ v.y),\ std::min(z,\ v.z));\ \}}
\DoxyCodeLine{00033\ \};}
\DoxyCodeLine{00034\ }
\DoxyCodeLine{00035\ \textcolor{keyword}{class\ }IPoint\_3}
\DoxyCodeLine{00036\ \{}
\DoxyCodeLine{00037\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00038\ \ \ \ \ int32\_t\ x,\ y,\ z;}
\DoxyCodeLine{00039\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00040\ \ \ \ \ IPoint\_3()\ \{\ \}}
\DoxyCodeLine{00041\ \ \ \ \ \textcolor{keyword}{constexpr}\ IPoint\_3(\textcolor{keywordtype}{int}\ X,\ \textcolor{keywordtype}{int}\ Y,\ \textcolor{keywordtype}{int}\ Z)\ :\ x(X),\ y(Y),\ z(Z)\ \{\ \}}
\DoxyCodeLine{00042\ \ \ \ \ IPoint\_3(\textcolor{keyword}{const}\ \mbox{\hyperlink{classIVector__3}{IVector\_3}}\ \&v)\ :\ x(v.x),\ y(v.y),\ z(v.z)\ \{\ \}}
\DoxyCodeLine{00043\ \ \ \ \ IPoint\_3(\textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ *v)\ :\ x(v[0]),\ y(v[1]),\ z(v[2])\ \{\ \}}
\DoxyCodeLine{00044\ \ \ \ \ IPoint\_3(\textcolor{keyword}{const}\ uint\ *v)\ :\ x(v[0]),\ y(v[1]),\ z(v[2])\ \{\ \}}
\DoxyCodeLine{00045\ \ \ \ \ IPoint\_3\&\ operator=(\textcolor{keyword}{const}\ IPoint\_3\ \&P)\ \{\ x\ =\ P.x;\ y\ =\ P.y;\ z\ =\ P.z;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00046\ \ \ \ \ \textcolor{keywordtype}{bool}\ operator==(\textcolor{keyword}{const}\ IPoint\_3\ \&P)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x\ ==\ P.x\ \&\&\ y\ ==\ P.y\ \&\&\ z\ ==\ P.z;\ \}}
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{keywordtype}{bool}\ operator!=(\textcolor{keyword}{const}\ IPoint\_3\ \&P)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x\ !=\ P.x\ ||\ y\ !=\ P.y\ ||\ z\ !=\ P.z;\ \}}
\DoxyCodeLine{00048\ \ \ \ \ \textcolor{keywordtype}{bool}\ isPositive()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x\ >=\ 0\ \&\&\ y\ >=\ 0\ \&\&\ z\ >=\ 0;\ \}}
\DoxyCodeLine{00049\ \ \ \ \ uint\ index(\textcolor{keyword}{const}\ \mbox{\hyperlink{classIVector__3}{IVector\_3}}\ \&size)\textcolor{keyword}{\ const\ }\{\ assert(isPositive());\ \textcolor{keywordflow}{return}\ z\ *\ size.z\ +\ y\ *\ size.y\ +\ x\ *\ size.x;\ \}}
\DoxyCodeLine{00050\ \ \ \ \ \mbox{\hyperlink{classIPoint__2}{IPoint\_2}}\ xy()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classIPoint__2}{IPoint\_2}}(x,\ y);\ \}}
\DoxyCodeLine{00051\ \ \ \ \ IPoint\_3\ operator+(\textcolor{keyword}{const}\ \mbox{\hyperlink{classIVector__3}{IVector\_3}}\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IPoint\_3(x\ +\ v.x,\ y\ +\ v.y,\ z\ +\ v.z);\ \}}
\DoxyCodeLine{00052\ \ \ \ \ IPoint\_3\ operator-\/(\textcolor{keyword}{const}\ \mbox{\hyperlink{classIVector__3}{IVector\_3}}\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IPoint\_3(x\ -\/\ v.x,\ y\ -\/\ v.y,\ z\ -\/\ v.z);\ \}}
\DoxyCodeLine{00053\ \ \ \ \ \mbox{\hyperlink{classIVector__3}{IVector\_3}}\ operator-\/(\textcolor{keyword}{const}\ IPoint\_3\ \&P)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classIVector__3}{IVector\_3}}(x\ -\/\ P.x,\ y\ -\/\ P.y,\ z\ -\/\ P.z);\ \}}
\DoxyCodeLine{00054\ \ \ \ \ IPoint\_3\&\ operator+=(\textcolor{keyword}{const}\ \mbox{\hyperlink{classIVector__3}{IVector\_3}}\ \&v)\ \{\ x\ +=\ v.x;\ y\ +=\ v.y;\ z\ +=\ v.z;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00055\ \ \ \ \ IPoint\_3\&\ operator-\/=(\textcolor{keyword}{const}\ \mbox{\hyperlink{classIVector__3}{IVector\_3}}\ \&v)\ \{\ x\ -\/=\ v.x;\ y\ -\/=\ v.y;\ z\ -\/=\ v.z;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00056\ \ \ \ \ \mbox{\hyperlink{classIVector__3}{IVector\_3}}\ vector()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classIVector__3}{IVector\_3}}(x,\ y,\ z);\ \}}
\DoxyCodeLine{00057\ \};}
\DoxyCodeLine{00058\ }
\DoxyCodeLine{00059\ \textcolor{keyword}{struct\ }IBox\_3}
\DoxyCodeLine{00060\ \{}
\DoxyCodeLine{00061\ \ \ \ \ IBox\_3()\ \{\ \}}
\DoxyCodeLine{00062\ \ \ \ \ \textcolor{keyword}{constexpr}\ IBox\_3(\textcolor{keyword}{const}\ \mbox{\hyperlink{classIPoint__3}{IPoint\_3}}\ \&mn,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classIPoint__3}{IPoint\_3}}\ \&mx)\ :\ min(mn),\ max(mx)\ \{\ \}}
\DoxyCodeLine{00063\ \ \ \ \ \mbox{\hyperlink{classIPoint__3}{IPoint\_3}}\ min;}
\DoxyCodeLine{00064\ \ \ \ \ \mbox{\hyperlink{classIPoint__3}{IPoint\_3}}\ max;}
\DoxyCodeLine{00065\ \ \ \ \ \textcolor{keywordtype}{bool}\ nonzero()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ min.x\ <=\ max.x\ \&\&\ min.y\ <=\ max.y\ \&\&\ min.z\ <=\ max.z;\ \}}
\DoxyCodeLine{00066\ \ \ \ \ uint\ w()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ max.x\ -\/\ min.x\ +\ 1;\ \}}
\DoxyCodeLine{00067\ \ \ \ \ uint\ h()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ max.y\ -\/\ min.y\ +\ 1;\ \}}
\DoxyCodeLine{00068\ \ \ \ \ uint\ d()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ max.z\ -\/\ min.z\ +\ 1;\ \}}
\DoxyCodeLine{00069\ \ \ \ \ int64\_t\ volume()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ w()\ *\ h()\ *\ d();\ \}}
\DoxyCodeLine{00070\ \ \ \ \ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ IBox\_3\ EMPTY()\ \{\ \textcolor{keywordflow}{return}\ IBox\_3(\mbox{\hyperlink{classIPoint__3}{IPoint\_3}}(1,1,1),\ \mbox{\hyperlink{classIPoint__3}{IPoint\_3}}(0,0,0));\ \}}
\DoxyCodeLine{00071\ \};}
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00073\ \textcolor{keyword}{inline}\ std::ostream\&\ operator<<(std::ostream\ \&os,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classIVector__3}{IVector\_3}}\ \&V)}
\DoxyCodeLine{00074\ \{}
\DoxyCodeLine{00075\ \ \ \ \ \textcolor{keywordflow}{return}\ os\ <<\ \textcolor{charliteral}{'('}\ <<\ V.x\ <<\ \textcolor{charliteral}{','}\ <<\ V.y\ <<\ \textcolor{charliteral}{','}\ <<\ V.z\ <<\ \textcolor{charliteral}{')'};}
\DoxyCodeLine{00076\ \}}
\DoxyCodeLine{00077\ \textcolor{keyword}{inline}\ std::ostream\&\ operator<<(std::ostream\ \&os,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classIPoint__3}{IPoint\_3}}\ \&P)}
\DoxyCodeLine{00078\ \{}
\DoxyCodeLine{00079\ \ \ \ \ \textcolor{keywordflow}{return}\ os\ <<\ \textcolor{charliteral}{'('}\ <<\ P.x\ <<\ \textcolor{charliteral}{','}\ <<\ P.y\ <<\ \textcolor{charliteral}{','}\ <<\ P.z\ <<\ \textcolor{charliteral}{')'};}
\DoxyCodeLine{00080\ \}}
\DoxyCodeLine{00081\ \textcolor{keyword}{inline}\ std::ostream\&\ operator<<(std::ostream\ \&os,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{structIBox__3}{IBox\_3}}\ \&B)}
\DoxyCodeLine{00082\ \{}
\DoxyCodeLine{00083\ \ \ \ \ \textcolor{keywordflow}{return}\ os\ <<\ \textcolor{charliteral}{'['}\ <<\ B.min.x\ <<\ \textcolor{charliteral}{','}\ <<\ B.min.y\ <<\ \textcolor{charliteral}{','}\ <<\ B.min.z\ <<\ \textcolor{stringliteral}{"{}]["{}}\ <<\ B.max.x\ <<\ \textcolor{charliteral}{','}\ <<\ B.max.y\ <<\ \textcolor{charliteral}{','}\ <<\ B.max.z\ <<\ \textcolor{charliteral}{']'};}
\DoxyCodeLine{00084\ \}}
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00086\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ GYM\_PCB\_MATH\_IPOINT3\_H}}

\end{DoxyCode}
