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

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#ifndef\ GYM\_PCB\_MATH\_IPOINT2}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#define\ GYM\_PCB\_MATH\_IPOINT2}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ "{}Defs.hpp"{}}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ <cmath>}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ <iostream>}}
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{keyword}{class\ }IVector\_2}
\DoxyCodeLine{00010\ \{}
\DoxyCodeLine{00011\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00012\ \ \ \ \ int32\_t\ x,\ y;}
\DoxyCodeLine{00013\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00014\ \ \ \ \ IVector\_2()\ \{\ \}}
\DoxyCodeLine{00015\ \ \ \ \ IVector\_2(\textcolor{keywordtype}{int}\ X,\ \textcolor{keywordtype}{int}\ Y)\ :\ x(X),\ y(Y)\ \{\ \}}
\DoxyCodeLine{00016\ \ \ \ \ IVector\_2(\textcolor{keyword}{const}\ IVector\_2\ \&v)\ :\ x(v.x),\ y(v.y)\ \{\ \}}
\DoxyCodeLine{00017\ \ \ \ \ IVector\_2\&\ operator=(\textcolor{keyword}{const}\ IVector\_2\ \&v)\ \{\ x\ =\ v.x;\ y\ =\ v.y;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00018\ \ \ \ \ \textcolor{keywordtype}{bool}\ operator==(\textcolor{keyword}{const}\ IVector\_2\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x\ ==\ v.x\ \&\&\ y\ ==\ v.y;\ \}}
\DoxyCodeLine{00019\ \ \ \ \ \textcolor{keywordtype}{bool}\ operator!=(\textcolor{keyword}{const}\ IVector\_2\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x\ !=\ v.x\ ||\ y\ !=\ v.y;\ \}}
\DoxyCodeLine{00020\ \ \ \ \ IVector\_2\ operator+(\textcolor{keyword}{const}\ IVector\_2\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IVector\_2(x\ +\ v.x,\ y\ +\ v.y);\ \}}
\DoxyCodeLine{00021\ \ \ \ \ IVector\_2\ operator-\/(\textcolor{keyword}{const}\ IVector\_2\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IVector\_2(x\ -\/\ v.x,\ y\ -\/\ v.y);\ \}}
\DoxyCodeLine{00022\ \ \ \ \ IVector\_2\ operator*(\textcolor{keywordtype}{int}\ s)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IVector\_2(x\ *\ s,\ y\ *\ s);\ \}}
\DoxyCodeLine{00023\ \ \ \ \ IVector\_2\ operator/(\textcolor{keywordtype}{int}\ s)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IVector\_2((x\ +\ s\ -\/\ 1)\ /\ s,\ (y\ +\ s\ -\/\ 1)\ /\ s);\ \}}
\DoxyCodeLine{00024\ \ \ \ \ IVector\_2\&\ operator+=(\textcolor{keyword}{const}\ IVector\_2\ \&v)\ \{\ x\ +=\ v.x;\ y\ +=\ v.y;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00025\ \ \ \ \ IVector\_2\&\ operator-\/=(\textcolor{keyword}{const}\ IVector\_2\ \&v)\ \{\ x\ -\/=\ v.x;\ y\ -\/=\ v.y;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00026\ \ \ \ \ IVector\_2\&\ operator*=(\textcolor{keywordtype}{int}\ s)\ \{\ *\textcolor{keyword}{this}\ =\ *\textcolor{keyword}{this}\ *\ s;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00027\ \ \ \ \ IVector\_2\&\ operator/=(\textcolor{keywordtype}{int}\ s)\ \{\ *\textcolor{keyword}{this}\ =\ *\textcolor{keyword}{this}\ /\ s;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00028\ \ \ \ \ IVector\_2\ abs()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IVector\_2(std::abs(x),\ std::abs(y));\ \}}
\DoxyCodeLine{00029\ \ \ \ \ int32\_t\ dot(\textcolor{keyword}{const}\ IVector\_2\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x\ *\ v.x\ +\ y\ *\ v.y;\ \}}
\DoxyCodeLine{00030\ \ \ \ \ int32\_t\ norm1()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ std::abs(x)\ +\ std::abs(y);\ \}}
\DoxyCodeLine{00031\ \ \ \ \ int32\_t\ hprod()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x\ *\ y;\ \}}
\DoxyCodeLine{00032\ \ \ \ \ IVector\_2\ max\_cw(\textcolor{keyword}{const}\ IVector\_2\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IVector\_2(std::max(x,\ v.x),\ std::max(y,\ v.y));\ \}}
\DoxyCodeLine{00033\ \ \ \ \ IVector\_2\ min\_cw(\textcolor{keyword}{const}\ IVector\_2\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IVector\_2(std::min(x,\ v.x),\ std::min(y,\ v.y));\ \}}
\DoxyCodeLine{00034\ \};}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00036\ \textcolor{keyword}{class\ }IPoint\_2}
\DoxyCodeLine{00037\ \{}
\DoxyCodeLine{00038\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00039\ \ \ \ \ int32\_t\ x,\ y;}
\DoxyCodeLine{00040\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00041\ \ \ \ \ IPoint\_2()\ \{\ \}}
\DoxyCodeLine{00042\ \ \ \ \ IPoint\_2(\textcolor{keywordtype}{int}\ X,\ \textcolor{keywordtype}{int}\ Y)\ :\ x(X),\ y(Y)\ \{\ \}}
\DoxyCodeLine{00043\ \ \ \ \ IPoint\_2(\textcolor{keyword}{const}\ \mbox{\hyperlink{classIVector__2}{IVector\_2}}\ \&v)\ :\ x(v.x),\ y(v.y)\ \{\ \}}
\DoxyCodeLine{00044\ \ \ \ \ IPoint\_2(\textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ *v)\ :\ x(v[0]),\ y(v[1])\ \{\ \}}
\DoxyCodeLine{00045\ \ \ \ \ IPoint\_2(\textcolor{keyword}{const}\ uint\ *v)\ :\ x(v[0]),\ y(v[1])\ \{\ \}}
\DoxyCodeLine{00046\ \ \ \ \ IPoint\_2\&\ operator=(\textcolor{keyword}{const}\ IPoint\_2\ \&P)\ \{\ x\ =\ P.x;\ y\ =\ P.y;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{keywordtype}{bool}\ operator==(\textcolor{keyword}{const}\ IPoint\_2\ \&P)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x\ ==\ P.x\ \&\&\ y\ ==\ P.y;\ \}}
\DoxyCodeLine{00048\ \ \ \ \ \textcolor{keywordtype}{bool}\ operator!=(\textcolor{keyword}{const}\ IPoint\_2\ \&P)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x\ !=\ P.x\ ||\ y\ !=\ P.y;\ \}}
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{keywordtype}{bool}\ isPositive()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x\ >=\ 0\ \&\&\ y\ >=\ 0;\ \}}
\DoxyCodeLine{00050\ \ \ \ \ IPoint\_2\ operator+(\textcolor{keyword}{const}\ \mbox{\hyperlink{classIVector__2}{IVector\_2}}\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IPoint\_2(x\ +\ v.x,\ y\ +\ v.y);\ \}}
\DoxyCodeLine{00051\ \ \ \ \ IPoint\_2\ operator-\/(\textcolor{keyword}{const}\ \mbox{\hyperlink{classIVector__2}{IVector\_2}}\ \&v)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ IPoint\_2(x\ -\/\ v.x,\ y\ -\/\ v.y);\ \}}
\DoxyCodeLine{00052\ \ \ \ \ IPoint\_2\&\ operator+=(\textcolor{keyword}{const}\ \mbox{\hyperlink{classIVector__2}{IVector\_2}}\ \&v)\ \{\ x\ +=\ v.x;\ y\ +=\ v.y;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00053\ \ \ \ \ IPoint\_2\&\ operator-\/=(\textcolor{keyword}{const}\ \mbox{\hyperlink{classIVector__2}{IVector\_2}}\ \&v)\ \{\ x\ -\/=\ v.x;\ y\ -\/=\ v.y;\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};\ \}}
\DoxyCodeLine{00054\ \ \ \ \ \mbox{\hyperlink{classIVector__2}{IVector\_2}}\ vector()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classIVector__2}{IVector\_2}}(x,\ y);\ \}}
\DoxyCodeLine{00055\ \};}
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00057\ \textcolor{keyword}{inline}\ std::ostream\&\ operator<<(std::ostream\ \&os,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classIVector__2}{IVector\_2}}\ \&v)}
\DoxyCodeLine{00058\ \{}
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{keywordflow}{return}\ os\ <<\ \textcolor{charliteral}{'('}\ <<\ v.x\ <<\ \textcolor{charliteral}{','}\ <<\ v.y\ <<\ \textcolor{charliteral}{')'};}
\DoxyCodeLine{00060\ \}}
\DoxyCodeLine{00061\ \textcolor{keyword}{inline}\ std::ostream\&\ operator<<(std::ostream\ \&os,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classIPoint__2}{IPoint\_2}}\ \&P)}
\DoxyCodeLine{00062\ \{}
\DoxyCodeLine{00063\ \ \ \ \ \textcolor{keywordflow}{return}\ os\ <<\ \textcolor{charliteral}{'('}\ <<\ P.x\ <<\ \textcolor{charliteral}{','}\ <<\ P.y\ <<\ \textcolor{charliteral}{')'};}
\DoxyCodeLine{00064\ \}}
\DoxyCodeLine{00065\ }
\DoxyCodeLine{00066\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ GYM\_PCB\_MATH\_IPOINT2}}

\end{DoxyCode}
