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

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#ifndef\ GYM\_PCB\_PATH\_H}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#define\ GYM\_PCB\_PATH\_H}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ "{}Py.hpp"{}}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ "{}Geometry.hpp"{}}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ <vector>}}
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classPin}{Pin}};}
\DoxyCodeLine{00010\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classVia}{Via}};}
\DoxyCodeLine{00011\ }
\DoxyCodeLine{00012\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classPath}{Path}}}
\DoxyCodeLine{00013\ \{}
\DoxyCodeLine{00014\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00015\ \ \ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{classPoint__25}{Point\_25}}\&\ getPoint(uint\ i)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mPoints.at(i);\ \}}
\DoxyCodeLine{00016\ \ \ \ \ \textcolor{keyword}{const}\ std::vector<Point\_25>\&\ getPoints()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mPoints;\ \}}
\DoxyCodeLine{00017\ \ \ \ \ \textcolor{keywordtype}{void}\ setPoint(uint\ i,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{classPoint__25}{Point\_25}}\ \&v)\ \{\ mPoints.at(i)\ =\ v;\ \}}
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00019\ \ \ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{classPoint__25}{Point\_25}}\&\ front()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mPoints.front();\ \}}
\DoxyCodeLine{00020\ \ \ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{classPoint__25}{Point\_25}}\&\ back()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mPoints.back();\ \}}
\DoxyCodeLine{00021\ \ \ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{classPoint__25}{Point\_25}}\&\ back(uint\ n)\textcolor{keyword}{\ const\ }\{\ assert(mPoints.size()\ >=\ n);\ \textcolor{keywordflow}{return}\ mPoints[mPoints.size()\ -\/\ n];\ \}}
\DoxyCodeLine{00022\ \ \ \ \ \mbox{\hyperlink{classPoint__25}{Point\_25}}\ pop\_back();}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ \ \ \ \ \textcolor{keywordtype}{bool}\ isPlanarAt(uint\ i)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00025\ \ \ \ \ Segment\_2\ getSegmentAt(uint\ i)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00027\ \ \ \ \ uint\ numPoints()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mPoints.size();\ \}}
\DoxyCodeLine{00028\ \ \ \ \ \textcolor{keywordtype}{bool}\ empty()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mPoints.empty();\ \}}
\DoxyCodeLine{00029\ \ \ \ \ uint\ numLayerChanges()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mNumLayerChanges;\ \}}
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00032\ \ \ \ \ Real\ \mbox{\hyperlink{classPath_a4630da04de7520bc74d63f4d3f876349}{length}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mLength;\ \}}
\DoxyCodeLine{00034\ \ \ \ \ Real\ \mbox{\hyperlink{classPath_acff95a303d8c067ca614e20af902b1ad}{RMSD}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mRMSD;\ \}}
\DoxyCodeLine{00036\ \ \ \ \ \textcolor{keywordtype}{float}\ \mbox{\hyperlink{classPath_a63c7be5313fdbf8bea4f2c58cfa678c5}{winding}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mWinding;\ \}}
\DoxyCodeLine{00037\ \ \ \ \ \textcolor{keywordtype}{float}\ turning()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mTurning;\ \}\ \textcolor{comment}{//\ sum\ of\ abs(angle)}}
\DoxyCodeLine{00038\ }
\DoxyCodeLine{00039\ \ \ \ \ Bbox\_2\ bbox()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00040\ \ \ \ \ Bbox\_2\ bbox(\textcolor{keywordtype}{int}\ z)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00042\ \ \ \ \ \textcolor{keywordtype}{void}\ clear();}
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keywordtype}{void}\ resizeTo1();}
\DoxyCodeLine{00045\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classPath_a5d6beb7e112816272c0018a5e01da5b3}{setPoints}}(\textcolor{keyword}{const}\ std::vector<Point\_25>\&,\ uint\ start,\ uint\ size);}
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classPath_aa6f25e9daec874cec56e477a0e37bbac}{\_add}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classPoint__25}{Point\_25}}\ \&v)\ \{\ mPoints.push\_back(v);\ \}}
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classPath_ae36608956c5c9df3619dbb92a70a656c}{add}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classPoint__25}{Point\_25}}\&);}
\DoxyCodeLine{00051\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classPath_a07a449389efd36a74abedd56f3b016e0}{extendTo}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classPoint__25}{Point\_25}}\&);}
\DoxyCodeLine{00052\ \ \ \ \ \textcolor{keywordtype}{void}\ append(\textcolor{keyword}{const}\ \mbox{\hyperlink{classPath}{Path}}\&);}
\DoxyCodeLine{00053\ \ \ \ \ \textcolor{keywordtype}{void}\ reverse();}
\DoxyCodeLine{00054\ \ \ \ \ uint\ removeUnnecessaryPoints();}
\DoxyCodeLine{00055\ }
\DoxyCodeLine{00057\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classPath_af0b7f2edf9ac2ea96f96a235c0c52340}{computeLength}}();}
\DoxyCodeLine{00058\ \ \ \ \ \textcolor{keywordtype}{void}\ computeRMSD();}
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{keywordtype}{void}\ computeWinding();}
\DoxyCodeLine{00060\ }
\DoxyCodeLine{00061\ \ \ \ \ \textcolor{keywordtype}{bool}\ compare(\textcolor{keyword}{const}\ \mbox{\hyperlink{classPath}{Path}}\&)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00062\ }
\DoxyCodeLine{00063\ \ \ \ \ Real\ squared\_distance(\textcolor{keyword}{const}\ \mbox{\hyperlink{classPoint__25}{Point\_25}}\&,\ Real\ dz\ =\ std::numeric\_limits<Real>::infinity())\ \textcolor{keyword}{const};}
\DoxyCodeLine{00064\ \ \ \ \ Real\ squared\_distance(\textcolor{keyword}{const}\ \mbox{\hyperlink{classPin}{Pin}}\&)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00065\ \ \ \ \ \textcolor{keywordtype}{bool}\ intersects(\textcolor{keyword}{const}\ \mbox{\hyperlink{classPath}{Path}}\&)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00066\ \ \ \ \ \textcolor{keywordtype}{bool}\ violatesClearance(\textcolor{keyword}{const}\ \mbox{\hyperlink{classPath}{Path}}\&,\ Real\ clearance)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00067\ \ \ \ \ \textcolor{keywordtype}{bool}\ violatesClearance(\textcolor{keyword}{const}\ \mbox{\hyperlink{classVia}{Via}}\&,\ Real\ clearance)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00068\ \ \ \ \ uint\ countIntersections(\textcolor{keyword}{const}\ \mbox{\hyperlink{classPath}{Path}}\&)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00069\ }
\DoxyCodeLine{00070\ \ \ \ \ std::string\ str()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00071\ \ \ \ \ PyObject\ *getIntegerPointsPy(Real\ scaleXY)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00072\ \ \ \ \ PyObject\ *getPointsNumpy()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00073\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00074\ \ \ \ \ std::vector<Point\_25>\ mPoints;}
\DoxyCodeLine{00075\ \ \ \ \ uint\ mNumLayerChanges\{0\};}
\DoxyCodeLine{00076\ \ \ \ \ Real\ mLength\{0.0f\};}
\DoxyCodeLine{00077\ \ \ \ \ Real\ mRMSD;}
\DoxyCodeLine{00078\ \ \ \ \ \textcolor{keywordtype}{float}\ mWinding;}
\DoxyCodeLine{00079\ \ \ \ \ \textcolor{keywordtype}{float}\ mTurning;}
\DoxyCodeLine{00080\ \};}
\DoxyCodeLine{00081\ }
\DoxyCodeLine{00082\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ Path::clear()}
\DoxyCodeLine{00083\ \{}
\DoxyCodeLine{00084\ \ \ \ \ mPoints.clear();}
\DoxyCodeLine{00085\ \ \ \ \ mLength\ =\ 0.0f;}
\DoxyCodeLine{00086\ \ \ \ \ mNumLayerChanges\ =\ 0;}
\DoxyCodeLine{00087\ \}}
\DoxyCodeLine{00088\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ Path::resizeTo1()}
\DoxyCodeLine{00089\ \{}
\DoxyCodeLine{00090\ \ \ \ \ mPoints.resize(1);}
\DoxyCodeLine{00091\ \ \ \ \ mLength\ =\ 0.0f;}
\DoxyCodeLine{00092\ \ \ \ \ mNumLayerChanges\ =\ 0;}
\DoxyCodeLine{00093\ \}}
\DoxyCodeLine{00094\ }
\DoxyCodeLine{00095\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{bool}\ Path::isPlanarAt(uint\ i)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00096\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00097\ \ \ \ \ assert(i\ >\ 0\ \&\&\ i\ <\ mPoints.size());}
\DoxyCodeLine{00098\ \ \ \ \ \textcolor{keywordflow}{return}\ mPoints[i].z()\ ==\ mPoints[i-\/1].z();}
\DoxyCodeLine{00099\ \}}
\DoxyCodeLine{00100\ \textcolor{keyword}{inline}\ Segment\_2\ Path::getSegmentAt(uint\ i)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00101\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00102\ \ \ \ \ assert(isPlanarAt(i));}
\DoxyCodeLine{00103\ \ \ \ \ \textcolor{keywordflow}{return}\ Segment\_2(mPoints[i-\/1].xy(),\ mPoints[i].xy());}
\DoxyCodeLine{00104\ \}}
\DoxyCodeLine{00105\ }
\DoxyCodeLine{00106\ \textcolor{keyword}{inline}\ \mbox{\hyperlink{classPoint__25}{Point\_25}}\ Path::pop\_back()}
\DoxyCodeLine{00107\ \{}
\DoxyCodeLine{00108\ \ \ \ \ assert(!empty());}
\DoxyCodeLine{00109\ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keyword}{auto}\ v\ =\ mPoints.back();}
\DoxyCodeLine{00110\ \ \ \ \ mPoints.pop\_back();}
\DoxyCodeLine{00111\ \ \ \ \ \textcolor{keywordflow}{return}\ v;}
\DoxyCodeLine{00112\ \}}
\DoxyCodeLine{00113\ }
\DoxyCodeLine{00114\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ GYM\_PCB\_PATH\_H}}

\end{DoxyCode}
