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

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#ifndef\ GYM\_PCB\_RASTERIZER\_H}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#define\ GYM\_PCB\_RASTERIZER\_H}}
\DoxyCodeLine{00003\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ "{}UniformGrid25.hpp"{}}}
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ "{}AShape.hpp"{}}}
\DoxyCodeLine{00011\ }
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#define\ RASTERIZE\_CAPS\_MASK\_SOURCE\ 0x1}}
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#define\ RASTERIZE\_CAPS\_MASK\_TARGET\ 0x2}}
\DoxyCodeLine{00014\ }
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#define\ RASTERIZE\_CAPS\_MASK\_BOTH\ (RASTERIZE\_CAPS\_MASK\_SOURCE\ |\ RASTERIZE\_CAPS\_MASK\_TARGET)}}
\DoxyCodeLine{00016\ }
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#define\ RASTERIZE\_MASK\_SEGMENTS\ \ 0x1}}
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#define\ RASTERIZE\_MASK\_VIAS\ \ \ \ \ \ 0x2}}
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#define\ RASTERIZE\_MASK\_CAPS\ \ \ \ \ \ 0x4}}
\DoxyCodeLine{00020\ \textcolor{preprocessor}{\#define\ RASTERIZE\_MASK\_JUNCTIONS\ 0x8}}
\DoxyCodeLine{00021\ \textcolor{preprocessor}{\#define\ RASTERIZE\_MASK\_ALL\ \ \ \ \ \ \ 0xf}}
\DoxyCodeLine{00022\ }
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#define\ RASTERIZE\_MASK\_CAPS\_AND\_JUNCTIONS\ (RASTERIZE\_MASK\_CAPS\ |\ RASTERIZE\_MASK\_JUNCTIONS)}}
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00025\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classTrack}{Track}};}
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00027\ \textcolor{keyword}{struct\ }IndexRange}
\DoxyCodeLine{00028\ \{}
\DoxyCodeLine{00029\ \ \ \ \ IndexRange(uint\ z0,\ uint\ z1,\ uint\ y0,\ uint\ y1,\ uint\ x0,\ uint\ x1)\ :\ Z0(z0),\ Z1(z1),\ Y0(y0),\ Y1(y0),\ X0(x0),\ X1(x1)\ \{\ \}}
\DoxyCodeLine{00030\ \ \ \ \ uint\ Z0,\ Z1;}
\DoxyCodeLine{00031\ \ \ \ \ uint\ Y0,\ Y1;}
\DoxyCodeLine{00032\ \ \ \ \ uint\ X0,\ X1;}
\DoxyCodeLine{00033\ \ \ \ \ uint\ countX()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ X1\ -\/\ X0\ +\ 1;\ \}}
\DoxyCodeLine{00034\ \ \ \ \ uint\ countY()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ Y1\ -\/\ Y0\ +\ 1;\ \}}
\DoxyCodeLine{00035\ \ \ \ \ uint\ countXY()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ countX()\ *\ countY();\ \}}
\DoxyCodeLine{00036\ \ \ \ \ uint\ countZ()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ Z1\ -\/\ Z0\ +\ 1;\ \}}
\DoxyCodeLine{00037\ \ \ \ \ uint\ count()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ countXY()\ *\ countZ();\ \}}
\DoxyCodeLine{00038\ \};}
\DoxyCodeLine{00039\ }
\DoxyCodeLine{00040\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classBaseROP}{BaseROP}}}
\DoxyCodeLine{00041\ \{}
\DoxyCodeLine{00042\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keywordtype}{void}\ reserve(uint\ N)\ \{\ \}}
\DoxyCodeLine{00044\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{void}\ writeRangeZYX(uint\ Z0,\ uint\ Z1,\ uint\ Y0,\ uint\ Y1,\ uint\ X0,\ uint\ X1)\ =\ 0;}
\DoxyCodeLine{00045\ \ \ \ \ \textcolor{keywordtype}{void}\ writeRangeZX(uint\ Z0,\ uint\ Z1,\ uint\ Y,\ uint\ X0,\ uint\ X1)\ \{\ writeRangeZYX(Z0,\ Z1,\ Y,\ Y,\ X0,\ X1);\ \}}
\DoxyCodeLine{00046\ \ \ \ \ \textcolor{keywordtype}{void}\ writeRangeZY(uint\ Z0,\ uint\ Z1,\ uint\ Y0,\ uint\ Y1,\ uint\ X)\ \{\ writeRangeZYX(Z0,\ Z1,\ Y0,\ Y1,\ X,\ X);\ \}}
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{keywordtype}{void}\ writeRangeYX(uint\ Z,\ uint\ Y0,\ uint\ Y1,\ uint\ X0,\ uint\ X1)\ \{\ writeRangeZYX(Z,\ Z,\ Y0,\ Y1,\ X0,\ X1);\ \}}
\DoxyCodeLine{00048\ \ \ \ \ \textcolor{keywordtype}{void}\ writeRangeY(uint\ Z,\ uint\ Y0,\ uint\ Y1,\ uint\ X)\ \{\ writeRangeZYX(Z,\ Z,\ Y0,\ Y1,\ X,\ X);\ \}}
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{keywordtype}{void}\ writeRangeX(uint\ Z,\ uint\ Y,\ uint\ X0,\ uint\ X1)\ \{\ writeRangeZYX(Z,\ Z,\ Y,\ Y,\ X0,\ X1);\ \}}
\DoxyCodeLine{00050\ \};}
\DoxyCodeLine{00051\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classRecordRangesROP}{RecordRangesROP}}\ final\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{classBaseROP}{BaseROP}}}
\DoxyCodeLine{00052\ \{}
\DoxyCodeLine{00053\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00054\ \ \ \ \ \textcolor{keywordtype}{void}\ reserve(uint\ N)\ \{\ mRanges.reserve(mRanges.size()\ +\ N);\ \}}
\DoxyCodeLine{00055\ \ \ \ \ \textcolor{keywordtype}{void}\ writeRangeZYX(uint\ Z0,\ uint\ Z1,\ uint\ Y0,\ uint\ Y1,\ uint\ X0,\ uint\ X1)\textcolor{keyword}{\ override\ }\{\ mRanges.emplace\_back(Z0,\ Z1,\ Y0,\ Y1,\ X0,\ X1);\ \}}
\DoxyCodeLine{00056\ \ \ \ \ \textcolor{keyword}{const}\ std::vector<IndexRange>\&\ getRanges()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mRanges;\ \}}
\DoxyCodeLine{00057\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00058\ \ \ \ \ std::vector<IndexRange>\ mRanges;}
\DoxyCodeLine{00059\ \};}
\DoxyCodeLine{00060\ }
\DoxyCodeLine{00061\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ ROP>\ \textcolor{keyword}{class\ }Rasterizer}
\DoxyCodeLine{00062\ \{}
\DoxyCodeLine{00063\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00064\ \ \ \ \ Rasterizer(\textcolor{keyword}{const}\ \mbox{\hyperlink{classUniformGrid25}{UniformGrid25}}\ \&G)\ :\ mGrid(G)\ \{\ mTolerance\ =\ G.EdgeLen\ /\ 1024.0;\ \}}
\DoxyCodeLine{00065\ \ \ \ \ ROP\ OP;}
\DoxyCodeLine{00066\ }
\DoxyCodeLine{00067\ \ \ \ \ \textcolor{keywordtype}{void}\ setExpansion(Real\ s)\ \{\ mExpansion\ =\ s;\ \}}
\DoxyCodeLine{00068\ }
\DoxyCodeLine{00069\ \ \ \ \ \textcolor{comment}{//\ Rules:}}
\DoxyCodeLine{00070\ \ \ \ \ \textcolor{comment}{//\ *\ All\ shapes\ except\ segments\ are\ closed\ sets\ (bundaries\ included).}}
\DoxyCodeLine{00071\ \ \ \ \ \textcolor{comment}{//\ *\ Fill\ uses\ the\ midpoint\ rule\ except\ when\ only\ 1\ point\ is\ covered.}}
\DoxyCodeLine{00072\ \ \ \ \ \textcolor{comment}{//\ *\ Segments\ are\ open\ sets\ on\ the\ sides\ and\ closed\ sets\ on\ the\ caps.}}
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00074\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeFill(\textcolor{keyword}{const}\ Bbox\_2\&,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00075\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeLine(\textcolor{keyword}{const}\ Bbox\_2\&,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00076\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeFill(\textcolor{keyword}{const}\ \mbox{\hyperlink{classSegment__25}{Segment\_25}}\&);}
\DoxyCodeLine{00077\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeLine(\textcolor{keyword}{const}\ \mbox{\hyperlink{classSegment__25}{Segment\_25}}\&);}
\DoxyCodeLine{00078\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeFill(\textcolor{keyword}{const}\ \mbox{\hyperlink{classSegment__25}{Segment\_25}}\&,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00079\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeLine(\textcolor{keyword}{const}\ \mbox{\hyperlink{classSegment__25}{Segment\_25}}\&,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00080\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeFill(\textcolor{keyword}{const}\ \mbox{\hyperlink{classWideSegment__25}{WideSegment\_25}}\&,\ uint\ capsMask\ =\ RASTERIZE\_CAPS\_MASK\_BOTH);}
\DoxyCodeLine{00081\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeLine(\textcolor{keyword}{const}\ \mbox{\hyperlink{classWideSegment__25}{WideSegment\_25}}\&,\ uint\ capsMask\ =\ RASTERIZE\_CAPS\_MASK\_BOTH);}
\DoxyCodeLine{00082\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeFill(\textcolor{keyword}{const}\ \mbox{\hyperlink{classWideSegment__25}{WideSegment\_25}}\&,\ uint\ capsMask,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00083\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeLine(\textcolor{keyword}{const}\ \mbox{\hyperlink{classWideSegment__25}{WideSegment\_25}}\&,\ uint\ capsMask,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00084\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeFill(\textcolor{keyword}{const}\ Circle\_2\&,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00085\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeLine(\textcolor{keyword}{const}\ Circle\_2\&,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00086\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeFill(\textcolor{keyword}{const}\ Triangle\_2\&,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00087\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeLine(\textcolor{keyword}{const}\ Triangle\_2\&,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00088\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeFill(\textcolor{keyword}{const}\ Polygon\_2\&,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00089\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeLine(\textcolor{keyword}{const}\ Polygon\_2\&,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeFill(\textcolor{keyword}{const}\ \mbox{\hyperlink{classAShape}{AShape}}\ *,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00092\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeLine(\textcolor{keyword}{const}\ \mbox{\hyperlink{classAShape}{AShape}}\ *,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00093\ }
\DoxyCodeLine{00094\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeFill(\textcolor{keyword}{const}\ \mbox{\hyperlink{classTrack}{Track}}\&,\ uint\ mask\ =\ RASTERIZE\_MASK\_ALL);}
\DoxyCodeLine{00095\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeLine(\textcolor{keyword}{const}\ \mbox{\hyperlink{classTrack}{Track}}\&);}
\DoxyCodeLine{00096\ }
\DoxyCodeLine{00097\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeRanges(\textcolor{keyword}{const}\ std::vector<IndexRange>\&);}
\DoxyCodeLine{00098\ }
\DoxyCodeLine{00099\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00100\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeDSegment(\textcolor{keyword}{const}\ Segment\_2\&,\ uint\ Z0,\ uint\ Z1,\ Real\ ex);}
\DoxyCodeLine{00101\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeHSegment(\textcolor{keyword}{const}\ Segment\_2\&,\ uint\ Z0,\ uint\ Z1,\ Real\ ex);}
\DoxyCodeLine{00102\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeVSegment(\textcolor{keyword}{const}\ Segment\_2\&,\ uint\ Z0,\ uint\ Z1,\ Real\ ex);}
\DoxyCodeLine{00103\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeDSegmentLine(\textcolor{keyword}{const}\ Segment\_2\&,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00104\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeHSegmentLine(\textcolor{keyword}{const}\ Segment\_2\&,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00105\ \ \ \ \ \textcolor{keywordtype}{void}\ rasterizeVSegmentLine(\textcolor{keyword}{const}\ Segment\_2\&,\ uint\ Z0,\ uint\ Z1);}
\DoxyCodeLine{00106\ }
\DoxyCodeLine{00107\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00108\ \ \ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{classUniformGrid25}{UniformGrid25}}\ \&mGrid;}
\DoxyCodeLine{00109\ \ \ \ \ Real\ mExpansion\{0.0\};}
\DoxyCodeLine{00110\ \ \ \ \ Real\ mTolerance;}
\DoxyCodeLine{00111\ \};}
\DoxyCodeLine{00112\ }
\DoxyCodeLine{00113\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ GYM\_PCB\_RASTERIZER\_H}}

\end{DoxyCode}
