aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a03764.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doxygen/nel/a03764.html')
-rw-r--r--docs/doxygen/nel/a03764.html1211
1 files changed, 1211 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a03764.html b/docs/doxygen/nel/a03764.html
new file mode 100644
index 00000000..c2a4b723
--- /dev/null
+++ b/docs/doxygen/nel/a03764.html
@@ -0,0 +1,1211 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+<title>NeL: NLLIGO::CZoneTemplate class Reference</title>
+<link href="doxygen.css" rel="stylesheet" type="text/css">
+</head><body>
+<!-- Generated by Doxygen 1.3.6 -->
+<div class="qindex"> <form class="search" action="search.php" method="get">
+<a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a> | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
+<h1>NLLIGO::CZoneTemplate Class Reference</h1><code>#include &lt;<a class="el" href="a06781.html">zone_template.h</a>&gt;</code>
+<p>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Ligo zone template<p>
+<dl compact><dt><b>Author:</b></dt><dd>Cyril 'Hulud' Corvazier <p>
+Nevrax France </dd></dl>
+<dl compact><dt><b>Date:</b></dt><dd>2001 </dd></dl>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a06781.html#l00049">49</a> of file <a class="el" href="a06781.html">zone_template.h</a>.<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03764.html#NLLIGO_1_1CZoneTemplatea0">build</a> (const std::vector&lt; <a class="el" href="a03128.html">NLMISC::CVector</a> &gt; &amp;vertices, const std::vector&lt; std::pair&lt; <a class="el" href="a04558.html#a15">uint</a>, <a class="el" href="a04558.html#a15">uint</a> &gt; &gt; &amp;indexes, const <a class="el" href="a02756.html">CLigoConfig</a> &amp;config, <a class="el" href="a02757.html">CLigoError</a> &amp;errors)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>const std::vector&lt; <a class="el" href="a03737.html">CZoneEdge</a> &gt; &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03764.html#NLLIGO_1_1CZoneTemplatea1">getEdges</a> () const </td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the vertex array of the template. <a href="#NLLIGO_1_1CZoneTemplatea1"></a><br><br></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03764.html#NLLIGO_1_1CZoneTemplatea2">getMask</a> (std::vector&lt; bool &gt; &amp;mask, <a class="el" href="a04558.html#a15">uint</a> &amp;<a class="el" href="a04223.html#a632">width</a>, <a class="el" href="a04558.html#a15">uint</a> &amp;<a class="el" href="a04223.html#a633">height</a>)</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the mask of the template. <a href="#NLLIGO_1_1CZoneTemplatea2"></a><br><br></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03764.html#NLLIGO_1_1CZoneTemplatea3">serial</a> (<a class="el" href="a02270.html">NLMISC::IStream</a> &amp;<a class="el" href="a04223.html#a626">s</a>)</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Serialisation. <a href="#NLLIGO_1_1CZoneTemplatea3"></a><br><br></td></tr>
+<tr><td colspan=2><br><h2>Static Private Member Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a10">sint32</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03764.html#NLLIGO_1_1CZoneTemplateh0">getSnappedIndex</a> (float <a class="el" href="a04223.html#a658">value</a>, float resolution, float snap)</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the interger index of a snappable value. <a href="#NLLIGO_1_1CZoneTemplateh0"></a><br><br></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03764.html#NLLIGO_1_1CZoneTemplateh1">isSnapedOnGrid</a> (float <a class="el" href="a04223.html#a658">value</a>, float resolution, float snap)</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return true if this value is snapped. <a href="#NLLIGO_1_1CZoneTemplateh1"></a><br><br></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03764.html#NLLIGO_1_1CZoneTemplateh2">snap</a> (float &amp;<a class="el" href="a04223.html#a658">value</a>, float snap)</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Round a value on the snap resolution. <a href="#NLLIGO_1_1CZoneTemplateh2"></a><br><br></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03764.html#NLLIGO_1_1CZoneTemplateh3">snapOnGrid</a> (float &amp;<a class="el" href="a04223.html#a658">value</a>, float resolution, float snap)</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Snap a value on the grid. <a href="#NLLIGO_1_1CZoneTemplateh3"></a><br><br></td></tr>
+<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector&lt; <a class="el" href="a03737.html">CZoneEdge</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a></td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Vertex array. <a href="#NLLIGO_1_1CZoneTemplater0"></a><br><br></td></tr>
+</table>
+<hr><h2>Member Function Documentation</h2>
+<a class="anchor" name="NLLIGO_1_1CZoneTemplatea0" doxytag="NLLIGO::CZoneTemplate::build" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> bool NLLIGO::CZoneTemplate::build </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::vector&lt; <a class="el" href="a03128.html">NLMISC::CVector</a> &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>vertices</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>const std::vector&lt; std::pair&lt; <a class="el" href="a04558.html#a15">uint</a>, <a class="el" href="a04558.html#a15">uint</a> &gt; &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>indexes</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>const <a class="el" href="a02756.html">CLigoConfig</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>config</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a02757.html">CLigoError</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>errors</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Build method. Build the zone template with a vertex list and an edge list.<p>
+<dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign=top><em>vertices</em>&nbsp;</td><td>is the vertex array </td></tr>
+ <tr><td valign=top><em>indexes</em>&nbsp;</td><td>is the edge array </td></tr>
+ <tr><td valign=top><em>config</em>&nbsp;</td><td>is the current lingo config file </td></tr>
+ <tr><td valign=top><em>errors</em>&nbsp;</td><td>is the error structure </td></tr>
+ </table>
+</dl>
+<dl compact><dt><b>Returns:</b></dt><dd>true if the build success, else return false</dd></dl>
+
+<p>
+Definition at line <a class="el" href="a06780.html#l00107">107</a> of file <a class="el" href="a06780.html">zone_template.cpp</a>.
+<p>
+References <a class="el" href="a06781.html#l00088">_Edges</a>, <a class="el" href="a05904.html#l00069">NLLIGO::CLigoConfig::CellSize</a>, <a class="el" href="a05905.html#l00080">NLLIGO::CLigoError::clear()</a>, <a class="el" href="a06780.html#l00093">getSnappedIndex()</a>, <a class="el" href="a06780.html#l00084">isSnapedOnGrid()</a>, <a class="el" href="a05906.html#l00124">NLLIGO::CLigoError::MainError</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05587.html#l00079">NLMISC::Pi</a>, <a class="el" href="a05905.html#l00040">NLLIGO::CLigoError::pushVertexError()</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a05904.html#l00072">NLLIGO::CLigoConfig::Snap</a>, <a class="el" href="a06780.html#l00039">NLLIGO::SnappedXFlag</a>, <a class="el" href="a06780.html#l00040">NLLIGO::SnappedYFlag</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>.
+<p>
+<div class="fragment"><pre>00108 {
+00109 <span class="comment">// Clear the error message</span>
+00110 errors.clear ();
+00111
+00112 <span class="comment">// Make an boundary flag array</span>
+00113 vector&lt;uint&gt; boundaryFlags;
+00114
+00115 <span class="comment">// Vertices count</span>
+00116 <a class="code" href="a04558.html#a15">uint</a> vertexCount = vertices.size();
+00117
+00118 <span class="comment">// Resize the array</span>
+00119 boundaryFlags.resize (vertexCount, 0);
+00120
+00121 <span class="comment">// *** Build the flag array and the snapped vertex array</span>
+00122
+00123 <span class="comment">// For each vertices</span>
+00124 <a class="code" href="a04558.html#a15">uint</a> vertex;
+00125 <span class="keywordflow">for</span> (vertex = 0; vertex &lt; vertexCount; vertex++)
+00126 {
+00127 <span class="comment">// Snap the point on the X grid</span>
+00128 <span class="keywordflow">if</span> (<a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplateh1">isSnapedOnGrid</a> (vertices[vertex].<a class="code" href="a04223.html#a572">x</a>, config.CellSize, config.Snap))
+00129 <span class="comment">// Flag on X</span>
+00130 boundaryFlags[vertex]|=<a class="code" href="a05375.html#a0">SnappedXFlag</a>;
+00131
+00132 <span class="comment">// Snap the point on the Y grid</span>
+00133 <span class="keywordflow">if</span> (<a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplateh1">isSnapedOnGrid</a> (vertices[vertex].<a class="code" href="a04223.html#a573">y</a>, config.CellSize, config.Snap))
+00134 <span class="comment">// Flag on Y</span>
+00135 boundaryFlags[vertex]|=<a class="code" href="a05375.html#a1">SnappedYFlag</a>;
+00136 }
+00137
+00138 <span class="comment">// *** Build the edge set</span>
+00139 multimap&lt;uint, uint&gt; edgePair;
+00140 multimap&lt;uint, uint&gt; edgePairReverse;
+00141
+00142 <span class="comment">// Index count</span>
+00143 <a class="code" href="a04558.html#a15">uint</a> edgeCount = indexes.size();
+00144
+00145 <span class="comment">// For each vertices</span>
+00146 <a class="code" href="a04558.html#a15">uint</a> edge;
+00147 <span class="keywordflow">for</span> (edge = 0; edge &lt; edgeCount; edge++)
+00148 {
+00149 <span class="comment">// Ref on the pair</span>
+00150 <span class="keyword">const</span> pair&lt;uint, uint&gt; &amp;theEdge = indexes[edge];
+00151
+00152 <span class="comment">// Vertex snapped ?</span>
+00153 <span class="keywordflow">if</span> ( boundaryFlags[theEdge.first] &amp;&amp; boundaryFlags[theEdge.second] )
+00154 {
+00155 <span class="comment">// Common coordinates</span>
+00156 <a class="code" href="a04558.html#a15">uint</a> common = boundaryFlags[theEdge.first] &amp; boundaryFlags[theEdge.second];
+00157
+00158 <span class="comment">// Snapped on the same kind of coordinates ?</span>
+00159 <span class="keywordflow">if</span> ( common )
+00160 {
+00161 <span class="comment">// Keep this edge ?</span>
+00162 <span class="keywordtype">bool</span> keep = <span class="keyword">false</span>;
+00163
+00164 <span class="comment">// Snapped both on X ?</span>
+00165 <span class="keywordflow">if</span> ( common &amp; <a class="code" href="a05375.html#a0">SnappedXFlag</a> )
+00166 {
+00167 <span class="comment">// Keep it</span>
+00168 keep = <span class="keyword">true</span>;
+00169 }
+00170
+00171 <span class="comment">// Snapped both on X ?</span>
+00172 <span class="keywordflow">if</span> ( common &amp; <a class="code" href="a05375.html#a1">SnappedYFlag</a> )
+00173 {
+00174 <span class="comment">// Keep it</span>
+00175 keep = <span class="keyword">true</span>;
+00176 }
+00177
+00178 <span class="comment">// Keep this edge ?</span>
+00179 <span class="keywordflow">if</span> (keep)
+00180 {
+00181 <span class="comment">// Already inserted ?</span>
+00182 <span class="keywordtype">bool</span> first = edgePair.find (theEdge.first) != edgePair.end();
+00183 <span class="keywordtype">bool</span> second = edgePairReverse.find (theEdge.second) != edgePairReverse.end();
+00184
+00185 <span class="comment">// First already inserted</span>
+00186 <span class="keywordflow">if</span> (first || second)
+00187 {
+00188 <span class="comment">// Error, two times the same vertex</span>
+00189 errors.MainError = CLigoError::VertexAlreadyUsed;
+00190
+00191 <span class="keywordflow">if</span> (first)
+00192 errors.pushVertexError (CLigoError::VertexAlreadyUsed, theEdge.first, 0);
+00193
+00194 <span class="keywordflow">if</span> (second)
+00195 errors.pushVertexError (CLigoError::VertexAlreadyUsed, theEdge.second, 0);
+00196
+00197 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00198 }
+00199
+00200 <span class="keywordflow">if</span> ((!first) &amp;&amp; (!second))
+00201 {
+00202 <span class="comment">// Add to the map</span>
+00203 edgePair.insert (map&lt;uint, uint&gt;::value_type(theEdge.first, theEdge.second));
+00204 edgePairReverse.insert (map&lt;uint, uint&gt;::value_type(theEdge.second, theEdge.first));
+00205 }
+00206 }
+00207 }
+00208 }
+00209 }
+00210
+00211 <span class="comment">// *** Build the list of non included vertices</span>
+00212
+00213 <span class="comment">// For each vertices</span>
+00214 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;vertexCount; i++)
+00215 {
+00216 <span class="comment">// Vertex is inserted ?</span>
+00217 <span class="keywordflow">if</span> (edgePair.find (i) == edgePair.end())
+00218 {
+00219 <span class="comment">// No, add an error message</span>
+00220 errors.pushVertexError (CLigoError::NotInserted, i, 0);
+00221 }
+00222 <span class="keywordflow">else</span>
+00223 {
+00224 <span class="comment">// No, add an error message</span>
+00225 errors.pushVertexError (CLigoError::Inserted, i, 0);
+00226 }
+00227 }
+00228
+00229 <span class="comment">// *** Build the linked list</span>
+00230
+00231 <span class="comment">// No vertices found ?</span>
+00232 <span class="keywordflow">if</span> (edgePair.begin() == edgePair.end())
+00233 {
+00234 <span class="comment">// Error message</span>
+00235 errors.MainError = CLigoError::NoEdgeVertices;
+00236 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00237 }
+00238
+00239 <span class="comment">// Build the linked segments</span>
+00240 <a class="code" href="a03889.html">list&lt;list&lt;uint&gt;</a> &gt; segmentList;
+00241 multimap&lt;uint, uint&gt;::iterator currentVert = edgePair.begin();
+00242
+00243 <span class="comment">// For each remaining segment</span>
+00244 <span class="keywordflow">while</span> (currentVert != edgePair.end())
+00245 {
+00246 <span class="comment">// Get next vert</span>
+00247 <a class="code" href="a04558.html#a15">uint</a> first = currentVert-&gt;first;
+00248 <a class="code" href="a04558.html#a15">uint</a> next = currentVert-&gt;second;
+00249
+00250 <span class="comment">// New list</span>
+00251 segmentList.push_front (<a class="code" href="a03889.html">list&lt;uint&gt;</a>());
+00252 <a class="code" href="a03889.html">list&lt;uint&gt;</a> &amp;listVert = *segmentList.begin();
+00253
+00254 <span class="comment">// Put the first vertices of the edge list</span>
+00255 listVert.push_back (first);
+00256 listVert.push_back (next);
+00257
+00258 <span class="comment">// Erase it and</span>
+00259 edgePair.erase (currentVert);
+00260
+00261 <span class="comment">// Erase the reverse one</span>
+00262 currentVert = edgePairReverse.find (next);
+00263 <a class="code" href="a04199.html#a6">nlassert</a> (currentVert != edgePairReverse.end());
+00264 edgePairReverse.erase (currentVert);
+00265
+00266 <span class="comment">// Look forward</span>
+00267 currentVert = edgePair.find (next);
+00268 <span class="keywordflow">while</span> (currentVert != edgePair.end())
+00269 {
+00270 <span class="comment">// Backup</span>
+00271 <span class="comment">//uint current = currentVert-&gt;first;</span>
+00272 next = currentVert-&gt;second;
+00273
+00274 <span class="comment">// Push the next vertex</span>
+00275 listVert.push_back (next);
+00276
+00277 <span class="comment">// Erase it and</span>
+00278 edgePair.erase (currentVert);
+00279
+00280 <span class="comment">// Erase the reverse one</span>
+00281 currentVert = edgePairReverse.find (next);
+00282 <a class="code" href="a04199.html#a6">nlassert</a> (currentVert != edgePairReverse.end());
+00283 edgePairReverse.erase (currentVert);
+00284
+00285 <span class="comment">// Look forward</span>
+00286 currentVert = edgePair.find (next);
+00287 }
+00288
+00289 <span class="comment">// Edgelist ok ?</span>
+00290 <span class="keywordflow">if</span> (next != first)
+00291 {
+00292 <span class="comment">// No, look backward</span>
+00293 currentVert = edgePairReverse.find (first);
+00294 <span class="keywordflow">while</span> (currentVert != edgePairReverse.end())
+00295 {
+00296 <span class="comment">// Backup</span>
+00297 <a class="code" href="a04558.html#a15">uint</a> current = currentVert-&gt;second;
+00298 next = currentVert-&gt;first;
+00299
+00300 <span class="comment">// Push the next vertex</span>
+00301 listVert.push_front (current);
+00302
+00303 <span class="comment">// Erase it</span>
+00304 edgePairReverse.erase (currentVert);
+00305
+00306 <span class="comment">// Erase the reverse one</span>
+00307 currentVert = edgePair.find (current);
+00308 <a class="code" href="a04199.html#a6">nlassert</a> (currentVert != edgePair.end());
+00309 edgePair.erase (currentVert);
+00310
+00311 <span class="comment">// Look forward</span>
+00312 currentVert = edgePairReverse.find (current);
+00313 }
+00314 }
+00315
+00316 <span class="comment">// Next edge list</span>
+00317 currentVert = edgePair.begin();
+00318 }
+00319
+00320 <span class="comment">// ** Error traitment</span>
+00321
+00322 <span class="comment">// Ok</span>
+00323 <span class="keywordtype">bool</span> ok = <span class="keyword">true</span>;
+00324
+00325 <span class="comment">// Edge index</span>
+00326 <a class="code" href="a04558.html#a15">uint</a> edgeIndex = 0;
+00327
+00328 <span class="comment">// List ok ?</span>
+00329 <a class="code" href="a03889.html">list&lt;list&lt;uint&gt;</a> &gt;::iterator iteList = segmentList.begin ();
+00330 <span class="keywordflow">while</span> (iteList != segmentList.end())
+00331 {
+00332 <span class="comment">// Only one list</span>
+00333 <a class="code" href="a03889.html">list&lt;uint&gt;</a> &amp;listVert = *iteList;
+00334
+00335 <span class="comment">// First and last edge</span>
+00336 <a class="code" href="a04558.html#a15">uint</a> first = *listVert.begin();
+00337 <a class="code" href="a04558.html#a15">uint</a> last = *(--listVert.end());
+00338
+00339 <span class="comment">// Opened edge ?</span>
+00340 <span class="keywordflow">if</span> ( first != last )
+00341 {
+00342 <span class="comment">// Opened edge</span>
+00343 errors.pushVertexError (CLigoError::OpenedEdge, first, edgeIndex);
+00344 errors.pushVertexError (CLigoError::OpenedEdge, last, edgeIndex);
+00345
+00346 <span class="comment">// Main error</span>
+00347 errors.MainError = CLigoError::OpenedEdge;
+00348
+00349 <span class="comment">// Not ko</span>
+00350 ok = <span class="keyword">false</span>;
+00351 }
+00352
+00353 <span class="comment">// Next edge list</span>
+00354 edgeIndex++;
+00355 iteList++;
+00356 }
+00357
+00358 <span class="keywordflow">if</span> (segmentList.size () &gt; 1)
+00359 {
+00360 <span class="comment">// Main error</span>
+00361 errors.MainError = CLigoError::MultipleEdge;
+00362
+00363 <span class="comment">// Not ok</span>
+00364 ok = <span class="keyword">false</span>;
+00365 }
+00366
+00367 <span class="comment">// Ok ?</span>
+00368 <span class="keywordflow">if</span> (ok)
+00369 {
+00370 <span class="comment">// Only one list</span>
+00371 <a class="code" href="a03889.html">list&lt;uint&gt;</a> &amp;listVert = *segmentList.begin ();
+00372
+00373 <span class="comment">// Test vertex enchainement</span>
+00374 <a class="code" href="a03889.html">list&lt;uint&gt;</a>::iterator vertIte = listVert.begin();
+00375
+00376 <span class="comment">// Current vertex id</span>
+00377 <a class="code" href="a04558.html#a15">uint</a> previous = *(--listVert.end());
+00378 vertIte++;
+00379
+00380 <span class="comment">// Error vertex set</span>
+00381 set&lt;uint&gt; errored;
+00382
+00383 <span class="comment">// For each vertices</span>
+00384 <span class="keywordflow">while</span> (vertIte != listVert.end ())
+00385 {
+00386 <span class="comment">// Vertex id</span>
+00387 <a class="code" href="a04558.html#a15">uint</a> next = *vertIte;
+00388
+00389 <span class="comment">// Common flags</span>
+00390 <a class="code" href="a04558.html#a15">uint</a> commonFlags = boundaryFlags[previous]&amp;boundaryFlags[next];
+00391
+00392 <span class="comment">// The both on X ?</span>
+00393 <span class="keywordflow">if</span> ( commonFlags &amp; <a class="code" href="a05375.html#a0">SnappedXFlag</a> )
+00394 {
+00395 <span class="comment">// Get x index</span>
+00396 <a class="code" href="a04558.html#a10">sint32</a> prevIndex = <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplateh0">getSnappedIndex</a> (vertices[previous].<a class="code" href="a04223.html#a572">x</a>, config.CellSize, config.Snap);
+00397 <a class="code" href="a04558.html#a10">sint32</a> nextIndex = <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplateh0">getSnappedIndex</a> (vertices[next].<a class="code" href="a04223.html#a572">x</a>, config.CellSize, config.Snap);
+00398
+00399 <span class="comment">// Not the same ?</span>
+00400 <span class="keywordflow">if</span> (prevIndex != nextIndex)
+00401 {
+00402 <span class="comment">// Vertex list error</span>
+00403 <span class="keywordflow">if</span> (errored.insert (previous).second)
+00404 errors.pushVertexError (CLigoError::VertexList, previous, 0);
+00405 <span class="keywordflow">if</span> (errored.insert (next).second)
+00406 errors.pushVertexError (CLigoError::VertexList, next, 0);
+00407
+00408 <span class="comment">// Main error</span>
+00409 errors.MainError = CLigoError::VertexList;
+00410 }
+00411 }
+00412
+00413 <span class="comment">// Next vertex</span>
+00414 previous = next;
+00415 vertIte++;
+00416 }
+00417
+00418 <span class="comment">// No error ?</span>
+00419 <span class="keywordflow">if</span> (errored.empty())
+00420 {
+00421 <span class="comment">// Only one list</span>
+00422 <a class="code" href="a04199.html#a6">nlassert</a> (segmentList.size()==1);
+00423
+00424 <span class="comment">// First of the list</span>
+00425 vertIte = listVert.begin();
+00426
+00427 <span class="comment">// Remove first</span>
+00428 listVert.erase (vertIte);
+00429
+00430 <span class="comment">// Find a corner</span>
+00431 <a class="code" href="a03889.html">list&lt;uint&gt;</a>::iterator firstIte = listVert.begin();
+00432 <span class="keywordflow">while</span> (firstIte != listVert.end())
+00433 {
+00434 <span class="comment">// Corner ?</span>
+00435 <span class="keywordflow">if</span> ( (boundaryFlags[*firstIte] &amp; (<a class="code" href="a05375.html#a0">SnappedXFlag</a>|<a class="code" href="a05375.html#a1">SnappedYFlag</a>)) == (<a class="code" href="a05375.html#a0">SnappedXFlag</a>|<a class="code" href="a05375.html#a1">SnappedYFlag</a>) )
+00436 <span class="comment">// Yes, exit</span>
+00437 <span class="keywordflow">break</span>;
+00438
+00439 <span class="comment">// Next </span>
+00440 firstIte++;
+00441 }
+00442
+00443 <span class="comment">// Can't be the last</span>
+00444 <span class="keywordflow">if</span> (firstIte == listVert.end())
+00445 {
+00446 <span class="comment">// No corner found</span>
+00447 errors.MainError = CLigoError::NoCornerFound;
+00448
+00449 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00450 }
+00451
+00452 <span class="comment">// First of the segment</span>
+00453 vertIte = firstIte;
+00454
+00455 <span class="comment">// Current edge list</span>
+00456 std::vector&lt;uint32&gt; edge;
+00457
+00458 <span class="comment">// Push the first</span>
+00459 edge.push_back (*vertIte);
+00460
+00461 <span class="comment">// Next </span>
+00462 vertIte++;
+00463
+00464 <span class="comment">// End ?</span>
+00465 <span class="keywordflow">if</span> (vertIte == listVert.end())
+00466 <span class="comment">// Start</span>
+00467 vertIte = listVert.begin();
+00468
+00469 <span class="comment">// Edge index</span>
+00470 <a class="code" href="a04558.html#a15">uint</a> edgeIndex = 0;
+00471
+00472 <span class="comment">// Build the edges</span>
+00473 <span class="keywordflow">while</span> (1)
+00474 {
+00475 <span class="comment">// Add it</span>
+00476 edge.push_back (*vertIte);
+00477
+00478 <span class="comment">// Corner ?</span>
+00479 <span class="keywordflow">if</span> ( (boundaryFlags[*vertIte] &amp; (<a class="code" href="a05375.html#a0">SnappedXFlag</a>|<a class="code" href="a05375.html#a1">SnappedYFlag</a>)) == (<a class="code" href="a05375.html#a0">SnappedXFlag</a>|<a class="code" href="a05375.html#a1">SnappedYFlag</a>) )
+00480 {
+00481 <span class="comment">// Get the index of start and end of the edge</span>
+00482 <a class="code" href="a04558.html#a10">sint32</a> startX = <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplateh0">getSnappedIndex</a> (vertices[edge[0]].<a class="code" href="a04223.html#a572">x</a>, config.CellSize, config.Snap);
+00483 <a class="code" href="a04558.html#a10">sint32</a> startY = <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplateh0">getSnappedIndex</a> (vertices[edge[0]].<a class="code" href="a04223.html#a573">y</a>, config.CellSize, config.Snap);
+00484 <a class="code" href="a04558.html#a10">sint32</a> endX = <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplateh0">getSnappedIndex</a> (vertices[edge[edge.size()-1]].x, config.CellSize, config.Snap);
+00485 <a class="code" href="a04558.html#a10">sint32</a> endY = <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplateh0">getSnappedIndex</a> (vertices[edge[edge.size()-1]].y, config.CellSize, config.Snap);
+00486
+00487 <span class="comment">// Same point ?</span>
+00488 <span class="keywordflow">if</span> ((startX==endX) &amp;&amp; (startY==endY))
+00489 {
+00490 <span class="comment">// Error, two times the same vertex</span>
+00491 errors.MainError = CLigoError::TwoCornerVertices;
+00492 errors.pushVertexError (CLigoError::TwoCornerVertices, edge[0], 0);
+00493 errors.pushVertexError (CLigoError::TwoCornerVertices, edge[edge.size()-1], 0);
+00494
+00495 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00496 }
+00497
+00498 <span class="comment">// Same point ?</span>
+00499 <span class="keywordflow">if</span> ((abs(startX-endX)&gt;1) || (abs(startY-endY)&gt;1))
+00500 {
+00501 <span class="comment">// Error, two times the same vertex</span>
+00502 errors.MainError = CLigoError::CornerIsMissing;
+00503 errors.pushVertexError (CLigoError::CornerIsMissing, edge[0], 0);
+00504 errors.pushVertexError (CLigoError::CornerIsMissing, edge[edge.size()-1], 0);
+00505
+00506 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00507 }
+00508
+00509 <span class="comment">// Get rotation</span>
+00510 <a class="code" href="a04558.html#a15">uint</a> rotation = 4;
+00511 <span class="keywordflow">if</span> ((endX-startX)==1)
+00512 {
+00513 <span class="keywordflow">if</span> ((endY-startY)==0)
+00514 rotation = 0;
+00515 }
+00516 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((endX-startX)==-1)
+00517 {
+00518 <span class="keywordflow">if</span> ((endY-startY)==0)
+00519 rotation = 2;
+00520 }
+00521 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((endX-startX)==0)
+00522 {
+00523 <span class="keywordflow">if</span> ((endY-startY)==1)
+00524 rotation = 1;
+00525 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((endY-startY)==-1)
+00526 rotation = 3;
+00527 }
+00528
+00529 <span class="comment">// Checks</span>
+00530 <a class="code" href="a04199.html#a6">nlassert</a> (rotation != 4);
+00531
+00532 <span class="comment">// Build the vertex array</span>
+00533 vector&lt;CVector&gt; vertexArray;
+00534 vertexArray.resize (edge.size());
+00535
+00536 <span class="comment">// Rotate matrix</span>
+00537 <a class="code" href="a02851.html">CMatrix</a> mat;
+00538 mat.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1961_0">identity</a>();
+00539 mat.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1965_4">rotateZ</a> ((<span class="keywordtype">float</span>)rotation * (<span class="keywordtype">float</span>)Pi / 2);
+00540 mat.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1961_4">setPos</a> (CVector (vertices[edge[0]].<a class="code" href="a04223.html#a572">x</a>, vertices[edge[0]].<a class="code" href="a04223.html#a573">y</a>, 0));
+00541 mat.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1967_0">invert</a> ();
+00542
+00543 <span class="comment">// Rotate the array</span>
+00544 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;edge.size(); i++)
+00545 {
+00546 <span class="comment">// Get the value on the edge</span>
+00547 vertexArray[i] = mat * vertices[edge[i]];
+00548 }
+00549
+00550 <span class="comment">// Build the edge</span>
+00551 <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a>.resize (edgeIndex+1);
+00552
+00553 <span class="comment">// It must work without errors</span>
+00554 CLigoError errorBis;
+00555 <span class="keywordflow">if</span> (!<a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a>[edgeIndex].build (vertexArray, edge, rotation, startX, startY, config, errorBis))
+00556 {
+00557 <span class="comment">// Flat zone</span>
+00558 errors.MainError = CLigoError::FlatZone;
+00559
+00560 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00561 }
+00562
+00563 <span class="comment">// One more edge</span>
+00564 edgeIndex++;
+00565
+00566 <span class="comment">// Exit ?</span>
+00567 <span class="keywordflow">if</span> (vertIte == firstIte)
+00568 <span class="keywordflow">break</span>;
+00569
+00570 <span class="comment">// Clear the temp edge</span>
+00571 edge.clear ();
+00572
+00573 <span class="comment">// Push back the last vertex</span>
+00574 edge.push_back (*vertIte);
+00575 }
+00576
+00577 <span class="comment">// Next vertex</span>
+00578 vertIte++;
+00579
+00580 <span class="comment">// End ?</span>
+00581 <span class="keywordflow">if</span> (vertIte == listVert.end())
+00582 <span class="comment">// Start</span>
+00583 vertIte = listVert.begin();
+00584 }
+00585
+00586 <a class="code" href="a04558.html#a10">sint32</a> bestX = 0x7fffffff;
+00587 <a class="code" href="a04558.html#a10">sint32</a> bestY = 0x80000000;
+00588 <a class="code" href="a04558.html#a15">uint</a> bestEdge = 0xffffffff;
+00589
+00590 <span class="comment">// Sort edges : the first as the lower x then greater y</span>
+00591 <a class="code" href="a04558.html#a15">uint</a> edgeId;
+00592 <span class="keywordflow">for</span> (edgeId=0; edgeId&lt;<a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a>.size(); edgeId++)
+00593 {
+00594 <span class="comment">// Get the matrix</span>
+00595 <a class="code" href="a02851.html">CMatrix</a> mat;
+00596 <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a>[edgeId].buildMatrix (mat, config);
+00597
+00598 <span class="comment">// First vertex</span>
+00599 CVector pos = mat * <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a>[edgeId].getVertex (0);
+00600
+00601 <span class="comment">// Get X and Y</span>
+00602 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a04223.html#a572">x</a> = <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplateh0">getSnappedIndex</a> (pos.x, config.CellSize, config.Snap);
+00603 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a04223.html#a573">y</a> = <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplateh0">getSnappedIndex</a> (pos.y, config.CellSize, config.Snap);
+00604
+00605 <span class="comment">// Best ?</span>
+00606 <span class="keywordflow">if</span> ((<a class="code" href="a04223.html#a572">x&lt;bestX)||((x==bestX)&amp;&amp;(y&gt;</a>bestY)))
+00607 {
+00608 <span class="comment">// This edgeId is best</span>
+00609 bestX=<a class="code" href="a04223.html#a572">x</a>;
+00610 bestY=<a class="code" href="a04223.html#a573">y</a>;
+00611 bestEdge = edgeId;
+00612 }
+00613 }
+00614
+00615 <span class="comment">// Check</span>
+00616 <a class="code" href="a04199.html#a6">nlassert</a> (bestEdge!=0xffffffff);
+00617
+00618 <span class="comment">// Reoder</span>
+00619 std::vector&lt;CZoneEdge&gt; newEdge (<a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a>.size());
+00620 <span class="keywordflow">for</span> (edgeId=0; edgeId&lt;<a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a>.size(); edgeId++)
+00621 {
+00622 <span class="comment">// Copy the edge</span>
+00623 newEdge[edgeId]=<a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a>[bestEdge++];
+00624
+00625 <span class="comment">// Next</span>
+00626 <span class="keywordflow">if</span> (bestEdge==_Edges.size())
+00627 bestEdge=0;
+00628 }
+00629
+00630 <span class="comment">// Copy the final array</span>
+00631 <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a>=newEdge;
+00632
+00633 <span class="comment">// Return ok</span>
+00634 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00635 }
+00636 }
+00637
+00638 <span class="comment">// Errors.</span>
+00639 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00640 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLLIGO_1_1CZoneTemplatea1" doxytag="NLLIGO::CZoneTemplate::getEdges" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const std::vector&lt;<a class="el" href="a03737.html">CZoneEdge</a>&gt;&amp; NLLIGO::CZoneTemplate::getEdges </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap> const<code> [inline]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get the vertex array of the template.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06781.html#l00068">68</a> of file <a class="el" href="a06781.html">zone_template.h</a>.
+<p>
+References <a class="el" href="a06781.html#l00088">_Edges</a>.
+<p>
+Referenced by <a class="el" href="a05907.html#l00038">NLLIGO::CMaterial::build()</a>, and <a class="el" href="a06578.html#l00228">NLLIGO::CTransition::check()</a>.
+<p>
+<div class="fragment"><pre>00068 { <span class="keywordflow">return</span> <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a>; }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLLIGO_1_1CZoneTemplatea2" doxytag="NLLIGO::CZoneTemplate::getMask" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void NLLIGO::CZoneTemplate::getMask </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">std::vector&lt; bool &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>width</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>height</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get the mask of the template.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06780.html#l00667">667</a> of file <a class="el" href="a06780.html">zone_template.cpp</a>.
+<p>
+References <a class="el" href="a06781.html#l00088">_Edges</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05646.html#l01013">width</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>.
+<p>
+<div class="fragment"><pre>00668 {
+00669 <span class="comment">// Some constantes</span>
+00670 <span class="keyword">const</span> <span class="keyword">static</span> <a class="code" href="a04558.html#a10">sint32</a> addX[4] = { 1, 0, -1, 0 };
+00671 <span class="keyword">const</span> <span class="keyword">static</span> <a class="code" href="a04558.html#a10">sint32</a> addY[4] = { 0, 1, 0, -1 };
+00672 <span class="keyword">const</span> <span class="keyword">static</span> <a class="code" href="a04558.html#a10">sint32</a> cellX[4] = { 0, -1, -1, 0 };
+00673 <span class="keyword">const</span> <span class="keyword">static</span> <a class="code" href="a04558.html#a10">sint32</a> cellY[4] = { 0, 0, -1, -1 };
+00674 <span class="keyword">const</span> <span class="keyword">static</span> <a class="code" href="a04558.html#a10">sint32</a> moveX[4] = { 0, 1, 0, -1 };
+00675 <span class="keyword">const</span> <span class="keyword">static</span> <a class="code" href="a04558.html#a10">sint32</a> moveY[4] = { -1, 0, 1, 0 };
+00676
+00677 <span class="comment">// Max</span>
+00678 <a class="code" href="a04558.html#a10">sint32</a> xMax = 0x80000000;
+00679 <a class="code" href="a04558.html#a10">sint32</a> yMax = 0x80000000;
+00680
+00681 <span class="comment">// For each edges</span>
+00682 <a class="code" href="a04558.html#a15">uint</a> edges;
+00683 <span class="keywordflow">for</span> (edges=0; edges&lt;<a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a>.size(); edges++)
+00684 {
+00685 <span class="comment">// Get the rotation</span>
+00686 <a class="code" href="a04558.html#a11">uint32</a> rot = <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a>[edges].getRotation ();
+00687 <a class="code" href="a04199.html#a6">nlassert</a> (rot&lt;4);
+00688
+00689 <span class="comment">// Get X and Y max coordinates</span>
+00690 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a04223.html#a572">x</a> = _Edges[edges].getOffsetX () + addX[rot];
+00691 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a04223.html#a573">y</a> = _Edges[edges].getOffsetY () + addY[rot];
+00692
+00693 <span class="comment">// Greater ?</span>
+00694 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a572">x</a> &gt; xMax)
+00695 xMax = <a class="code" href="a04223.html#a572">x</a>;
+00696 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a573">y</a> &gt; yMax)
+00697 yMax = <a class="code" href="a04223.html#a573">y</a>;
+00698 }
+00699
+00700 <span class="comment">// Build the array</span>
+00701 <a class="code" href="a04223.html#a632">width</a> = (<a class="code" href="a04558.html#a11">uint32</a>) xMax;
+00702 <a class="code" href="a04223.html#a633">height</a> = (<a class="code" href="a04558.html#a11">uint32</a>) yMax;
+00703
+00704 <span class="comment">// Bit array for each cell</span>
+00705 vector&lt;uint32&gt; edgeArray (xMax*yMax, 0);
+00706
+00707 <span class="comment">// Resize it</span>
+00708 mask.resize (xMax*yMax, <span class="keyword">false</span>);
+00709
+00710 <span class="comment">// Set of the cells in the mask</span>
+00711 set&lt;pair&lt;sint32, sint32&gt; &gt; setCell;
+00712
+00713 <span class="comment">// For each edge</span>
+00714 <span class="keywordflow">for</span> (edges=0; edges&lt;<a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a>.size(); edges++)
+00715 {
+00716 <span class="comment">// Get the rotation</span>
+00717 <a class="code" href="a04558.html#a11">uint32</a> rot = <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplater0">_Edges</a>[edges].getRotation ();
+00718 <a class="code" href="a04199.html#a6">nlassert</a> (rot&lt;4);
+00719
+00720 <span class="comment">// Get its x and y cell coordinate</span>
+00721 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a04223.html#a572">x</a> = _Edges[edges].getOffsetX () + cellX[rot];
+00722 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a04223.html#a573">y</a> = _Edges[edges].getOffsetY () + cellY[rot];
+00723
+00724 <span class="comment">// Fill the edge array</span>
+00725 edgeArray[<a class="code" href="a04223.html#a572">x</a>+<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a>] |= (1&lt;&lt;rot);
+00726
+00727 <span class="comment">// Insert the cell</span>
+00728 setCell.insert ( pair&lt;sint32, sint32&gt; (x, y) );
+00729 }
+00730
+00731 <span class="comment">// Second set</span>
+00732 set&lt;pair&lt;sint32, sint32&gt; &gt; setCell2;
+00733
+00734 <span class="comment">// For each element in the set</span>
+00735 set&lt;pair&lt;sint32, sint32&gt; &gt;::iterator ite = setCell.begin();
+00736 <span class="keywordflow">while</span> (ite != setCell.end())
+00737 {
+00738 <span class="comment">// For each direction</span>
+00739 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> dir=0; dir&lt;4; dir++)
+00740 {
+00741 <span class="comment">// Get its x and y cell coordinate</span>
+00742 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a04223.html#a572">x</a> = ite-&gt;first;
+00743 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a04223.html#a573">y</a> = ite-&gt;second;
+00744
+00745 <span class="comment">// Edge in this direction ?</span>
+00746 <span class="keywordflow">while</span> ( (edgeArray[<a class="code" href="a04223.html#a572">x</a>+<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a632">width</a>] &amp; (1&lt;&lt;dir) ) == 0)
+00747 {
+00748 <span class="comment">// Move in this direction</span>
+00749 <a class="code" href="a04223.html#a572">x</a> += moveX[dir];
+00750 <a class="code" href="a04223.html#a573">y</a> += moveY[dir];
+00751
+00752 <span class="comment">// insert it</span>
+00753 setCell2.insert ( pair&lt;sint32, sint32&gt; (x, y) );
+00754
+00755 <span class="comment">// Some checks</span>
+00756 <a class="code" href="a04199.html#a6">nlassert</a> (x&gt;=0);
+00757 <a class="code" href="a04199.html#a6">nlassert</a> (x&lt;(<a class="code" href="a04558.html#a10">sint32</a>)width);
+00758 <a class="code" href="a04199.html#a6">nlassert</a> (y&gt;=0);
+00759 <a class="code" href="a04199.html#a6">nlassert</a> (y&lt;(<a class="code" href="a04558.html#a10">sint32</a>)height);
+00760 }
+00761 }
+00762
+00763 <span class="comment">// Next one</span>
+00764 ite++;
+00765 }
+00766
+00767 <span class="comment">// Merge the two set</span>
+00768 ite = setCell2.begin();
+00769 <span class="keywordflow">while</span> (ite != setCell2.end())
+00770 {
+00771 <span class="comment">// Merge</span>
+00772 setCell.insert (*ite);
+00773
+00774 <span class="comment">// Next element</span>
+00775 ite++;
+00776 }
+00777
+00778 <span class="comment">// Done, fill the array</span>
+00779 ite = setCell.begin();
+00780 <span class="keywordflow">while</span> (ite != setCell.end())
+00781 {
+00782 <span class="comment">// Merge</span>
+00783 mask[ite-&gt;first+ite-&gt;second*<a class="code" href="a04223.html#a632">width</a>] = <span class="keyword">true</span>;
+00784
+00785 <span class="comment">// Next element</span>
+00786 ite++;
+00787 }
+00788 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLLIGO_1_1CZoneTemplateh0" doxytag="NLLIGO::CZoneTemplate::getSnappedIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a10">sint32</a> NLLIGO::CZoneTemplate::getSnappedIndex </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">float&nbsp;</td>
+ <td class="mdname" nowrap> <em>value</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>float&nbsp;</td>
+ <td class="mdname" nowrap> <em>resolution</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>float&nbsp;</td>
+ <td class="mdname" nowrap> <em>snap</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"><code> [inline, static, private]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the interger index of a snappable value.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06780.html#l00093">93</a> of file <a class="el" href="a06780.html">zone_template.cpp</a>.
+<p>
+References <a class="el" href="a05622.html#l00355">nlverify</a>, <a class="el" href="a05981.html#l00099">sint32</a>, and <a class="el" href="a05646.html#l01132">value</a>.
+<p>
+Referenced by <a class="el" href="a06780.html#l00107">build()</a>.
+<p>
+<div class="fragment"><pre>00094 {
+00095 <span class="comment">// Snapped</span>
+00096 <span class="keywordtype">float</span> snapped = <a class="code" href="a04223.html#a658">value</a>;
+00097
+00098 <span class="comment">// This value must be snapped</span>
+00099 <a class="code" href="a04199.html#a9">nlverify</a> (snapOnGrid (snapped, resolution, snap));
+00100
+00101 <span class="comment">// Return the index</span>
+00102 <span class="keywordflow">return</span> (<a class="code" href="a04558.html#a10">sint32</a>) floor ( (snapped / resolution) + 0.5f );
+00103 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLLIGO_1_1CZoneTemplateh1" doxytag="NLLIGO::CZoneTemplate::isSnapedOnGrid" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> bool NLLIGO::CZoneTemplate::isSnapedOnGrid </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">float&nbsp;</td>
+ <td class="mdname" nowrap> <em>value</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>float&nbsp;</td>
+ <td class="mdname" nowrap> <em>resolution</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>float&nbsp;</td>
+ <td class="mdname" nowrap> <em>snap</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"><code> [inline, static, private]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return true if this value is snapped.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06780.html#l00084">84</a> of file <a class="el" href="a06780.html">zone_template.cpp</a>.
+<p>
+References <a class="el" href="a06780.html#l00052">snapOnGrid()</a>, and <a class="el" href="a05646.html#l01132">value</a>.
+<p>
+Referenced by <a class="el" href="a06780.html#l00107">build()</a>.
+<p>
+<div class="fragment"><pre>00085 {
+00086 <span class="comment">// Snapped</span>
+00087 <span class="keywordtype">float</span> snapped = <a class="code" href="a04223.html#a658">value</a>;
+00088 <span class="keywordflow">return</span> <a class="code" href="a03764.html#NLLIGO_1_1CZoneTemplateh3">snapOnGrid</a> (snapped, resolution, snap);
+00089 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLLIGO_1_1CZoneTemplatea3" doxytag="NLLIGO::CZoneTemplate::serial" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void NLLIGO::CZoneTemplate::serial </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="a02270.html">NLMISC::IStream</a> &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>s</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Serialisation.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06780.html#l00644">644</a> of file <a class="el" href="a06780.html">zone_template.cpp</a>.
+<p>
+References <a class="el" href="a06781.html#l00088">_Edges</a>, and <a class="el" href="a05646.html#l00977">s</a>.
+<p>
+<div class="fragment"><pre>00645 {
+00646 <span class="comment">// open an XML node</span>
+00647 <a class="code" href="a04223.html#a626">s</a>.xmlPush (<span class="stringliteral">"LIGO_ZONE_TEMPLATE"</span>);
+00648
+00649 <span class="comment">// An header file</span>
+00650 <a class="code" href="a04223.html#a626">s</a>.serialCheck (string (<span class="stringliteral">"LigoZoneTemplate"</span>) );
+00651
+00652 <span class="comment">// Node for the boundaries</span>
+00653 <a class="code" href="a04223.html#a626">s</a>.xmlPush (<span class="stringliteral">"EDGES"</span>);
+00654
+00655 <span class="comment">// Serial the Vertices</span>
+00656 <a class="code" href="a04223.html#a626">s</a>.serialCont (_Edges);
+00657
+00658 <span class="comment">// Node for the boundaries</span>
+00659 <a class="code" href="a04223.html#a626">s</a>.xmlPop ();
+00660
+00661 <span class="comment">// Close the node</span>
+00662 <a class="code" href="a04223.html#a626">s</a>.xmlPop ();
+00663 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLLIGO_1_1CZoneTemplateh2" doxytag="NLLIGO::CZoneTemplate::snap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void NLLIGO::CZoneTemplate::snap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">float &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>value</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>float&nbsp;</td>
+ <td class="mdname" nowrap> <em>snap</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"><code> [inline, static, private]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Round a value on the snap resolution.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06780.html#l00044">44</a> of file <a class="el" href="a06780.html">zone_template.cpp</a>.
+<p>
+References <a class="el" href="a05646.html#l01132">value</a>.
+<p>
+<div class="fragment"><pre>00045 {
+00046 <span class="comment">// Snap it</span>
+00047 <a class="code" href="a04223.html#a658">value</a> = snap * (<span class="keywordtype">float</span>) floor ( (value / snap) + 0.5f );
+00048 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLLIGO_1_1CZoneTemplateh3" doxytag="NLLIGO::CZoneTemplate::snapOnGrid" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> bool NLLIGO::CZoneTemplate::snapOnGrid </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">float &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>value</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>float&nbsp;</td>
+ <td class="mdname" nowrap> <em>resolution</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>float&nbsp;</td>
+ <td class="mdname" nowrap> <em>snap</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"><code> [inline, static, private]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Snap a value on the grid.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06780.html#l00052">52</a> of file <a class="el" href="a06780.html">zone_template.cpp</a>.
+<p>
+References <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05646.html#l01132">value</a>.
+<p>
+Referenced by <a class="el" href="a06780.html#l00084">isSnapedOnGrid()</a>.
+<p>
+<div class="fragment"><pre>00053 {
+00054 <span class="comment">// Calc the floor</span>
+00055 <span class="keywordtype">float</span> _floor = (<span class="keywordtype">float</span>) ( resolution * floor (value / resolution) );
+00056 <a class="code" href="a04199.html#a6">nlassert</a> (_floor&lt;=value);
+00057
+00058 <span class="comment">// Calc the remainder</span>
+00059 <span class="keywordtype">float</span> remainder = <a class="code" href="a04223.html#a658">value</a> - _floor;
+00060 <span class="comment">//nlassert ( (remainder&gt;=0) &amp;&amp; (remainder&lt;resolution) );</span>
+00061
+00062 <span class="comment">// Check the snape</span>
+00063 <span class="keywordflow">if</span> ( remainder &lt;= snap )
+00064 {
+00065 <span class="comment">// Flag it</span>
+00066 <a class="code" href="a04223.html#a658">value</a> = _floor;
+00067
+00068 <span class="comment">// Floor is good</span>
+00069 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00070 }
+00071 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( (resolution - remainder) &lt;= snap )
+00072 {
+00073 <span class="comment">// Flag it</span>
+00074 <a class="code" href="a04223.html#a658">value</a> = _floor + resolution;
+00075
+00076 <span class="comment">// Floor + resolution is good</span>
+00077 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00078 }
+00079 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00080 }
+</pre></div> </td>
+ </tr>
+</table>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="NLLIGO_1_1CZoneTemplater0" doxytag="NLLIGO::CZoneTemplate::_Edges" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> std::vector&lt;<a class="el" href="a03737.html">CZoneEdge</a>&gt; <a class="el" href="a03764.html#NLLIGO_1_1CZoneTemplater0">NLLIGO::CZoneTemplate::_Edges</a><code> [private]</code>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Vertex array.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06781.html#l00088">88</a> of file <a class="el" href="a06781.html">zone_template.h</a>.
+<p>
+Referenced by <a class="el" href="a06780.html#l00107">build()</a>, <a class="el" href="a06781.html#l00068">getEdges()</a>, <a class="el" href="a06780.html#l00667">getMask()</a>, and <a class="el" href="a06780.html#l00644">serial()</a>. </td>
+ </tr>
+</table>
+<hr>The documentation for this class was generated from the following files:<ul>
+<li><a class="el" href="a06781.html">zone_template.h</a><li><a class="el" href="a06780.html">zone_template.cpp</a></ul>
+<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 12:52:18 2004 for NeL by
+<a href="http://www.doxygen.org/index.html">
+<img src="doxygen.png" alt="doxygen" align="middle" border=0 >
+</a>1.3.6 </small></address>
+</body>
+</html>