aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a03101.html
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
committerneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
commit0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch)
tree2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a03101.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to 'docs/doxygen/nel/a03101.html')
-rw-r--r--docs/doxygen/nel/a03101.html1770
1 files changed, 1770 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a03101.html b/docs/doxygen/nel/a03101.html
new file mode 100644
index 00000000..ad9605cc
--- /dev/null
+++ b/docs/doxygen/nel/a03101.html
@@ -0,0 +1,1770 @@
+<!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: NLMISC::CPolygon2D 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>NLMISC::CPolygon2D Class Reference</h1><code>#include &lt;<a class="el" href="a06191.html">polygon.h</a>&gt;</code>
+<p>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+A 2d convex polygon
+<p>
+
+<p>
+Definition at line <a class="el" href="a06191.html#l00122">122</a> of file <a class="el" href="a06191.html">polygon.h</a>.<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Public Types</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::pair&lt; <a class="el" href="a04558.html#a14">sint</a>, <a class="el" href="a04558.html#a14">sint</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw0">TRaster</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::vector&lt; <a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw0">TRaster</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw1">TRasterVect</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::vector&lt; <a class="el" href="a03660.html">CVector2f</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw2">TVec2fVect</a></td></tr>
+
+<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Da0">buildConvexHull</a> (<a class="el" href="a03101.html">CPolygon2D</a> &amp;dest) const </td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Da1">computeBorders</a> (<a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw1">TRasterVect</a> &amp;borders, <a class="el" href="a04558.html#a14">sint</a> &amp;minimumY)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Da2">computeInnerBorders</a> (<a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw1">TRasterVect</a> &amp;borders, <a class="el" href="a04558.html#a14">sint</a> &amp;minimumY)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Da3">computeOuterBorders</a> (<a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw1">TRasterVect</a> &amp;borders, <a class="el" href="a04558.html#a14">sint</a> &amp;minimumY)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Da4">contains</a> (const <a class="el" href="a03660.html">CVector2f</a> &amp;p) const </td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check wether a point is contained by this poly. <a href="#NLMISC_1_1CPolygon2Da4"></a><br><br></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Da5">CPolygon2D</a> (const <a class="el" href="a03616.html">CTriangle</a> &amp;tri, const <a class="el" href="a02851.html">CMatrix</a> &amp;projMat=<a class="el" href="a02851.html#NLMISC_1_1CMatrixs0">CMatrix::Identity</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Da6">CPolygon2D</a> (const <a class="el" href="a03100.html">CPolygon</a> &amp;<a class="el" href="a04223.html#a652">src</a>, const <a class="el" href="a02851.html">CMatrix</a> &amp;projMat=<a class="el" href="a02851.html#NLMISC_1_1CMatrixs0">CMatrix::Identity</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Da7">CPolygon2D</a> ()</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">default ctor <a href="#NLMISC_1_1CPolygon2Da7"></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="a03101.html#NLMISC_1_1CPolygon2Da8">getBestTriplet</a> (<a class="el" href="a04558.html#a15">uint</a> &amp;index0, <a class="el" href="a04558.html#a15">uint</a> &amp;index1, <a class="el" href="a04558.html#a15">uint</a> &amp;index2)</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">get the best triplet of vector. e.g the triplet that has the best surface <a href="#NLMISC_1_1CPolygon2Da8"></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="a03101.html#NLMISC_1_1CPolygon2Da9">getLineEquation</a> (<a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a566">index</a>, float &amp;a, float &amp;b, float &amp;c) const </td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get a line equation of the seg starting at the given index. <a href="#NLMISC_1_1CPolygon2Da9"></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="a03101.html#NLMISC_1_1CPolygon2Da10">getNonNullSeg</a> (<a class="el" href="a04558.html#a15">uint</a> &amp;seg) const </td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Da11">intersect</a> (const <a class="el" href="a03101.html">CPolygon2D</a> &amp;other) const </td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Test wether this polygon intersect another convex polygon. Currently not optimized. <a href="#NLMISC_1_1CPolygon2Da11"></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="a03101.html#NLMISC_1_1CPolygon2Da12">isConvex</a> ()</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check wether this polygon is convex;. <a href="#NLMISC_1_1CPolygon2Da12"></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="a03101.html#NLMISC_1_1CPolygon2Da13">serial</a> (<a class="el" href="a02270.html">NLMISC::IStream</a> &amp;f) throw (NLMISC::EStream)</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Serial this polygon. <a href="#NLMISC_1_1CPolygon2Da13"></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="a03101.html#NLMISC_1_1CPolygon2Da14">swap</a> (<a class="el" href="a03101.html">CPolygon2D</a> &amp;other)</td></tr>
+
+<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw2">TVec2fVect</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a></td></tr>
+
+<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dd0">getSegRef0</a> (<a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a566">index</a>) const </td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get ref to the first vertex that start at index. <a href="#NLMISC_1_1CPolygon2Dd0"></a><br><br></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dd1">getSegRef1</a> (<a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a566">index</a>) const </td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>float&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dd2">sumDPAgainstLine</a> (float a, float b, float c) const </td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sum the dot product of this poly vertices against a plane. <a href="#NLMISC_1_1CPolygon2Dd2"></a><br><br></td></tr>
+</table>
+<hr><h2>Member Typedef Documentation</h2>
+<a class="anchor" name="NLMISC_1_1CPolygon2Dw0" doxytag="NLMISC::CPolygon2D::TRaster" ></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"> typedef std::pair&lt;<a class="el" href="a04558.html#a14">sint</a>, <a class="el" href="a04558.html#a14">sint</a>&gt; <a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw0">NLMISC::CPolygon2D::TRaster</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a06191.html#l00159">159</a> of file <a class="el" href="a06191.html">polygon.h</a>.
+<p>
+Referenced by <a class="el" href="a06768.html#l00444">RenderTriangle()</a>, <a class="el" href="a06190.html#l01517">NLMISC::ScanInnerEdge()</a>, <a class="el" href="a06190.html#l01288">NLMISC::ScanOuterEdgeLeft()</a>, and <a class="el" href="a06190.html#l01232">NLMISC::ScanOuterEdgeRight()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Dw1" doxytag="NLMISC::CPolygon2D::TRasterVect" ></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"> typedef std::vector&lt;<a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw0">TRaster</a>&gt; <a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw1">NLMISC::CPolygon2D::TRasterVect</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a06191.html#l00160">160</a> of file <a class="el" href="a06191.html">polygon.h</a>.
+<p>
+Referenced by <a class="el" href="a05937.html#l00066">NL3D::CLodCharacterShapeBuild::compile()</a>, <a class="el" href="a06190.html#l01075">computeBorders()</a>, <a class="el" href="a06190.html#l01618">computeInnerBorders()</a>, <a class="el" href="a06190.html#l01344">computeOuterBorders()</a>, <a class="el" href="a06768.html#l00444">RenderTriangle()</a>, <a class="el" href="a06768.html#l00633">NL3D::CRenderZBuffer::run()</a>, <a class="el" href="a06190.html#l01003">NLMISC::ScanEdge()</a>, and <a class="el" href="a06737.html#l00437">NL3D::CWaterModel::traverseRender()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Dw2" doxytag="NLMISC::CPolygon2D::TVec2fVect" ></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"> typedef std::vector&lt;<a class="el" href="a03660.html">CVector2f</a>&gt; <a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw2">NLMISC::CPolygon2D::TVec2fVect</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a06191.html#l00125">125</a> of file <a class="el" href="a06191.html">polygon.h</a>.
+<p>
+Referenced by <a class="el" href="a06190.html#l01075">computeBorders()</a>, <a class="el" href="a06190.html#l01057">NLMISC::Next()</a>, and <a class="el" href="a06190.html#l01067">NLMISC::Prev()</a>. </td>
+ </tr>
+</table>
+<hr><h2>Constructor &amp; Destructor Documentation</h2>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da7" doxytag="NLMISC::CPolygon2D::CPolygon2D" ></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"> NLMISC::CPolygon2D::CPolygon2D </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><code> [inline]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+default ctor
+<p>
+
+<p>
+Definition at line <a class="el" href="a06191.html#l00129">129</a> of file <a class="el" href="a06191.html">polygon.h</a>.
+<p>
+<div class="fragment"><pre>00129 {}
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da6" doxytag="NLMISC::CPolygon2D::CPolygon2D" ></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"> NLMISC::CPolygon2D::CPolygon2D </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const <a class="el" href="a03100.html">CPolygon</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>src</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>const <a class="el" href="a02851.html">CMatrix</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>projMat</em> = <a class="el" href="a02851.html#NLMISC_1_1CMatrixs0">CMatrix::Identity</a></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 a 2D polygon from this 3D polygon, by using the given projection matrix The x and y components of projected vertices are used to create the 2D polygon
+<p>
+Definition at line <a class="el" href="a06190.html#l00785">785</a> of file <a class="el" href="a06190.html">polygon.cpp</a>.
+<p>
+References <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, and <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>.
+<p>
+<div class="fragment"><pre>00786 {
+00787 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a587">size</a> = <a class="code" href="a04223.html#a652">src</a>.Vertices.size();
+00788 <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.resize(size);
+00789 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> k = 0; k &lt; <a class="code" href="a04223.html#a587">size</a>; ++k)
+00790 {
+00791 CVector proj = projMat * <a class="code" href="a04223.html#a652">src</a>.Vertices[k];
+00792 <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[k].set(proj.x, proj.y);
+00793 }
+00794 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da5" doxytag="NLMISC::CPolygon2D::CPolygon2D" ></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"> NLMISC::CPolygon2D::CPolygon2D </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const <a class="el" href="a03616.html">CTriangle</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>tri</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>const <a class="el" href="a02851.html">CMatrix</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>projMat</em> = <a class="el" href="a02851.html#NLMISC_1_1CMatrixs0">CMatrix::Identity</a></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 a 2D polygon from the given triangle, by using the given projection matrix The x and y components of projected vertices are used to create the 2D polygon
+<p>
+Definition at line <a class="el" href="a06190.html#l01928">1928</a> of file <a class="el" href="a06190.html">polygon.cpp</a>.
+<p>
+References <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V0</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V1</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V2</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>01929 {
+01930 <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.resize(3);
+01931 <a class="code" href="a03128.html">NLMISC::CVector</a> proj[3] = { projMat * tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo3">V0</a>, projMat * tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo4">V1</a>, projMat * tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo5">V2</a> };
+01932 <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[0].set(proj[0].<a class="code" href="a04223.html#a572">x</a>, proj[0].<a class="code" href="a04223.html#a573">y</a>);
+01933 <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[1].set(proj[1].<a class="code" href="a04223.html#a572">x</a>, proj[1].<a class="code" href="a04223.html#a573">y</a>);
+01934 <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[2].set(proj[2].<a class="code" href="a04223.html#a572">x</a>, proj[2].<a class="code" href="a04223.html#a573">y</a>);
+01935 }
+</pre></div> </td>
+ </tr>
+</table>
+<hr><h2>Member Function Documentation</h2>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da0" doxytag="NLMISC::CPolygon2D::buildConvexHull" ></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 NLMISC::CPolygon2D::buildConvexHull </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="a03101.html">CPolygon2D</a> &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dest</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap> const</td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Build a convex hull from this polygon. The result poly is ordered, so it can also be used to order a convex poly given its set of vertices. NB: require this != &amp;dest
+<p>
+Definition at line <a class="el" href="a06190.html#l00836">836</a> of file <a class="el" href="a06190.html">polygon.cpp</a>.
+<p>
+References <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06191.html#l00126">Vertices</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>.
+<p>
+<div class="fragment"><pre>00837 {
+00838 <a class="code" href="a04199.html#a6">nlassert</a>(&amp;dest != <span class="keyword">this</span>);
+00839
+00840 <span class="keywordflow">if</span> (this-&gt;<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size() == 3) <span class="comment">// with 3 points it is always convex</span>
+00841 {
+00842 dest = *<span class="keyword">this</span>;
+00843 <span class="keywordflow">return</span>;
+00844 }
+00845 <a class="code" href="a04558.html#a15">uint</a> k, <a class="code" href="a05373.html#a2">l</a>;
+00846 <a class="code" href="a04558.html#a15">uint</a> numVerts = <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size();
+00847 CVector2f p, curr, prev;
+00848 <a class="code" href="a04558.html#a15">uint</a> pIndex, p1Index, p2Index, pCurr, pPrev;
+00849 <span class="comment">// this is not optimized, but not used in realtime.. =)</span>
+00850 <a class="code" href="a04199.html#a6">nlassert</a>(numVerts &gt;= 3);
+00851 dest.Vertices.clear();
+00852
+00853 <span class="keyword">typedef</span> std::set&lt;uint&gt; TIndexSet;
+00854 TIndexSet leftIndex;
+00855 <span class="keywordflow">for</span> (k = 0; k &lt; <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size(); ++k)
+00856 {
+00857 leftIndex.insert(k);
+00858 }
+00859
+00860
+00861 <span class="comment">// 1) find the highest point p of the set. We are sure it belongs to the hull</span>
+00862 pIndex = 0;
+00863 p = <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[0];
+00864 <span class="keywordflow">for</span> (k = 1; k &lt; numVerts; ++k)
+00865 {
+00866 <span class="keywordflow">if</span> (Vertices[k].y &lt; p.y)
+00867 {
+00868 pIndex = k;
+00869 p = Vertices[k];
+00870 }
+00871 }
+00872
+00873 leftIndex.erase(pIndex);
+00874
+00875
+00876 <span class="keywordtype">float</span> bestCP = 1.1f;
+00877 p1Index = p2Index = pIndex;
+00878
+00879 <span class="keywordflow">for</span> (k = 0; k &lt; numVerts; ++k)
+00880 {
+00881 <span class="keywordflow">if</span> (k != pIndex)
+00882 {
+00883 <span class="keywordflow">for</span> (<a class="code" href="a05373.html#a2">l</a> = 0; <a class="code" href="a05373.html#a2">l</a> &lt; numVerts; ++<a class="code" href="a05373.html#a2">l</a>)
+00884 {
+00885 <span class="keywordflow">if</span> (<a class="code" href="a05373.html#a2">l</a> != pIndex &amp;&amp; <a class="code" href="a05373.html#a2">l</a> != k)
+00886 {
+00887 CVector2f seg1 = (Vertices[<a class="code" href="a05373.html#a2">l</a>] - p).normed();
+00888 CVector2f seg2 = (Vertices[k] - p).normed();
+00889
+00890 <span class="comment">//CVector cp = CVector(seg1.x, seg1.y, 0) ^ CVector(seg2.x, seg2.y, 0);</span>
+00891 <span class="comment">//float n = fabsf(cp.z);</span>
+00892 <span class="keywordtype">float</span> n = seg1 * seg2;
+00893 <span class="keywordflow">if</span> (n &lt; bestCP)
+00894 {
+00895 p1Index = <a class="code" href="a05373.html#a2">l</a>;
+00896 p2Index = k;
+00897 bestCP = n;
+00898 }
+00899 }
+00900 }
+00901 }
+00902 }
+00903
+00904
+00905 leftIndex.erase(p2Index);
+00906
+00907
+00908
+00909 <span class="comment">// start from the given triplet, and complete the poly until we reach the first point</span>
+00910 pCurr = p2Index;
+00911 pPrev = pIndex;
+00912
+00913 curr = Vertices[pCurr];
+00914 prev = Vertices[pPrev];
+00915
+00916 <span class="comment">// create the first triplet vertices</span>
+00917 dest.Vertices.push_back(Vertices[p1Index]);
+00918 dest.Vertices.push_back(prev);
+00919 dest.Vertices.push_back(curr);
+00920
+00921 <a class="code" href="a04558.html#a15">uint</a> step = 0;
+00922
+00923 <span class="keywordflow">for</span>(;;)
+00924 {
+00925 bestCP = 1.1f;
+00926 CVector2f seg2 = (prev - curr).normed();
+00927 TIndexSet::const_iterator bestIt = leftIndex.end();
+00928 <span class="keywordflow">for</span> (TIndexSet::const_iterator it = leftIndex.begin(); it != leftIndex.end(); ++it)
+00929 {
+00930 <span class="keywordflow">if</span> (step == 0 &amp;&amp; *it == p1Index) <span class="keywordflow">continue</span>;
+00931 CVector2f seg1 = (Vertices[*it] - curr).normed();
+00932 <span class="keywordtype">float</span> n = seg1 * seg2;
+00933 <span class="keywordflow">if</span> (n &lt; bestCP)
+00934 {
+00935 bestCP = n;
+00936 bestIt = it;
+00937 }
+00938 }
+00939
+00940 <a class="code" href="a04199.html#a6">nlassert</a>(bestIt != leftIndex.end());
+00941 <span class="keywordflow">if</span> (*bestIt == p1Index)
+00942 {
+00943 <span class="keywordflow">return</span>; <span class="comment">// if we reach the start point we have finished</span>
+00944 }
+00945 prev = curr;
+00946 curr = Vertices[*bestIt];
+00947 pPrev = pCurr;
+00948 pCurr = *bestIt;
+00949 <span class="comment">// add new point to the destination</span>
+00950 dest.Vertices.push_back(curr);
+00951 ++step;
+00952 leftIndex.erase(bestIt);
+00953 }
+00954 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da1" doxytag="NLMISC::CPolygon2D::computeBorders" ></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 NLMISC::CPolygon2D::computeBorders </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw1">TRasterVect</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>borders</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>minimumY</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>
+Compute the borders of this poly with sub-pixel accuracy. No clipping is performed. Only points exactly inside or exactly on the left border of the polygon are kept. This means that pixels are seen as points, not as surfaces. The output is in a vector of sint pairs. minimumY is filled with the minimum y value of the poly. Each pairs gives [xmin, xmax] for the current segment. if xmin &gt; xmax, then no point is valid for this segment. Otherwise, all points from x = xmin (included) to x = xmax (included) are valids.
+<p>
+Definition at line <a class="el" href="a06190.html#l01075">1075</a> of file <a class="el" href="a06190.html">polygon.cpp</a>.
+<p>
+References <a class="el" href="a06190.html#l01057">NLMISC::Next()</a>, <a class="el" href="a06190.html#l01067">NLMISC::Prev()</a>, <a class="el" href="a06190.html#l01003">NLMISC::ScanEdge()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06191.html#l00160">TRasterVect</a>, <a class="el" href="a06191.html#l00125">TVec2fVect</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
+<p>
+Referenced by <a class="el" href="a05937.html#l00066">NL3D::CLodCharacterShapeBuild::compile()</a>, <a class="el" href="a06768.html#l00444">RenderTriangle()</a>, and <a class="el" href="a06737.html#l00437">NL3D::CWaterModel::traverseRender()</a>.
+<p>
+<div class="fragment"><pre>01076 {
+01077 <span class="comment">// an 'alias' to the vertices</span>
+01078 <span class="keyword">const</span> <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Dw2">TVec2fVect</a> &amp;V = <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>;
+01079 <span class="keywordflow">if</span> (Vertices.size() &lt; 3)
+01080 {
+01081 borders.clear();
+01082 <span class="keywordflow">return</span>;
+01083 }
+01084 <span class="keywordtype">bool</span> ccw; <span class="comment">// set to true when it has a counter clock wise orientation</span>
+01085
+01086 <span class="comment">// compute highest and lowest pos of the poly</span>
+01087 <span class="keywordtype">float</span> fHighest = V[0].y;
+01088 <span class="keywordtype">float</span> fLowest = fHighest;
+01089
+01090 <span class="comment">// iterators to the thighest and lowest vertex</span>
+01091 TVec2fVect::const_iterator pLowest = V.begin(), pHighest = V.begin();
+01092 TVec2fVect::const_iterator it = V.begin() ;
+01093 <span class="keyword">const</span> TVec2fVect::const_iterator endIt = V.end();
+01094 <span class="keywordflow">do</span>
+01095 {
+01096 <span class="keywordflow">if</span> (it-&gt;y &gt; fLowest)
+01097 {
+01098 fLowest = it-&gt;y;
+01099 pLowest = it;
+01100 }
+01101 <span class="keywordflow">else</span>
+01102 <span class="keywordflow">if</span> (it-&gt;y &lt; fHighest)
+01103 {
+01104 fHighest = it-&gt;y;
+01105 pHighest = it;
+01106 }
+01107 ++it;
+01108 }
+01109 <span class="keywordflow">while</span> (it != endIt);
+01110
+01111
+01112 <a class="code" href="a04558.html#a14">sint</a> iHighest = (<a class="code" href="a04558.html#a14">sint</a>) ceilf(fHighest) ;
+01113 <a class="code" href="a04558.html#a14">sint</a> iLowest = (<a class="code" href="a04558.html#a14">sint</a>) ceilf(fLowest) ;
+01114
+01115 highestY = iHighest;
+01116
+01117
+01119 <a class="code" href="a04558.html#a15">uint</a> polyHeight = iLowest - iHighest;
+01120 <span class="keywordflow">if</span> (polyHeight &lt;= 0)
+01121 {
+01122 borders.clear();
+01123 <span class="keywordflow">return</span>;
+01124 }
+01125
+01126 borders.resize(polyHeight);
+01127
+01128 <span class="comment">// iterator to the first vertex that has an y different from the top vertex</span>
+01129 TVec2fVect::const_iterator pHighestRight = pHighest;
+01130 <span class="comment">// we seek this vertex </span>
+01131 <span class="keywordflow">while</span> (<a class="code" href="a05378.html#a346">Next</a>(pHighestRight, V)-&gt;y == fHighest)
+01132 {
+01133 pHighestRight = <a class="code" href="a05378.html#a346">Next</a>(pHighestRight, V);
+01134 }
+01135
+01136 <span class="comment">// iterator to the first vertex after pHighestRight, that has the same y than the highest vertex</span>
+01137 TVec2fVect::const_iterator pHighestLeft = <a class="code" href="a05378.html#a346">Next</a>(pHighestRight, V);
+01138 <span class="comment">// seek the vertex</span>
+01139 <span class="keywordflow">while</span> (pHighestLeft-&gt;y != fHighest)
+01140 {
+01141 pHighestLeft = <a class="code" href="a05378.html#a346">Next</a>(pHighestLeft, V);
+01142 }
+01143
+01144 TVec2fVect::const_iterator pPrevHighestLeft = <a class="code" href="a05378.html#a347">Prev</a>(pHighestLeft, V);
+01145
+01146 <span class="comment">// we need to get the orientation of the polygon</span>
+01147 <span class="comment">// There are 2 case : flat, and non-flat top</span>
+01148
+01149 <span class="comment">// check for flat top</span>
+01150 <span class="keywordflow">if</span> (pHighestLeft-&gt;x != pHighestRight-&gt;x)
+01151 {
+01152 <span class="comment">// compare right and left side</span>
+01153 <span class="keywordflow">if</span> (pHighestLeft-&gt;x &gt; pHighestRight-&gt;x)
+01154 {
+01155 ccw = <span class="keyword">true</span>; <span class="comment">// the list is CCW oriented</span>
+01156 std::swap(pHighestLeft, pHighestRight);
+01157 }
+01158 <span class="keywordflow">else</span>
+01159 {
+01160 ccw = <span class="keyword">false</span>; <span class="comment">// the list is CW oriented </span>
+01161 }
+01162 }
+01163 <span class="keywordflow">else</span>
+01164 {
+01165 <span class="comment">// The top of the poly is sharp</span>
+01166 <span class="comment">// We perform a cross product of the 2 highest vect to get its orientation</span>
+01167
+01168 <span class="keyword">const</span> <span class="keywordtype">float</span> deltaXN = <a class="code" href="a05378.html#a346">Next</a>(pHighestRight, V)-&gt;x - pHighestRight-&gt;x;
+01169 <span class="keyword">const</span> <span class="keywordtype">float</span> deltaYN = <a class="code" href="a05378.html#a346">Next</a>(pHighestRight, V)-&gt;y - pHighestRight-&gt;y;
+01170 <span class="keyword">const</span> <span class="keywordtype">float</span> deltaXP = pPrevHighestLeft-&gt;x - pHighestLeft-&gt;x;
+01171 <span class="keyword">const</span> <span class="keywordtype">float</span> deltaYP = pPrevHighestLeft-&gt;y - pHighestLeft-&gt;y;
+01172 <span class="keywordflow">if</span> ((deltaXN * deltaYP - deltaYN * deltaXP) &lt; 0)
+01173 {
+01174 ccw = <span class="keyword">true</span>; <span class="comment">// the list is CCW oriented</span>
+01175 std::swap(pHighestLeft, pHighestRight);
+01176 }
+01177 <span class="keywordflow">else</span>
+01178 {
+01179 ccw = <span class="keyword">false</span>; <span class="comment">// the list is CW oriented</span>
+01180 }
+01181 }
+01182
+01183
+01184 <span class="comment">// compute borders</span>
+01185 TVec2fVect::const_iterator currV, nextV; <span class="comment">// current and next vertex</span>
+01186 <span class="keywordflow">if</span> (!ccw) <span class="comment">// clock wise order ?</span>
+01187 {
+01188 currV = pHighestRight ;
+01189 <span class="comment">// compute right edge from top to bottom</span>
+01190 <span class="keywordflow">do</span>
+01191 {
+01192 nextV = <a class="code" href="a05378.html#a346">Next</a>(currV, V);
+01193 <a class="code" href="a05378.html#a345">ScanEdge</a>(borders, iHighest, *currV, *nextV, <span class="keyword">true</span>);
+01194 currV = nextV;
+01195 }
+01196 <span class="keywordflow">while</span> (currV != pLowest); <span class="comment">// repeat until we reach the bottom vertex</span>
+01197
+01198 <span class="comment">// compute left edge from bottom to top</span>
+01199 <span class="keywordflow">do</span>
+01200 {
+01201 nextV = <a class="code" href="a05378.html#a346">Next</a>(currV, V);
+01202 <a class="code" href="a05378.html#a345">ScanEdge</a>(borders, iHighest, *nextV, *currV, <span class="keyword">false</span>);
+01203 currV = nextV;
+01204 }
+01205 <span class="keywordflow">while</span> (currV != pHighestLeft);
+01206 }
+01207 <span class="keywordflow">else</span> <span class="comment">// ccw order</span>
+01208 {
+01209 currV = pHighestLeft;
+01210 <span class="comment">// compute left edge from top to bottom</span>
+01211 <span class="keywordflow">do</span>
+01212 {
+01213 nextV = <a class="code" href="a05378.html#a346">Next</a>(currV, V);
+01214 <a class="code" href="a05378.html#a345">ScanEdge</a>(borders, iHighest, *currV, *nextV, <span class="keyword">false</span>) ;
+01215 currV = nextV;
+01216 }
+01217 <span class="keywordflow">while</span> (currV != pLowest) ;
+01218
+01219 <span class="comment">// compute right edge from bottom to top</span>
+01220 <span class="keywordflow">do</span>
+01221 {
+01222 nextV = <a class="code" href="a05378.html#a346">Next</a>(currV, V);
+01223 <a class="code" href="a05378.html#a345">ScanEdge</a>(borders, iHighest, *nextV, *currV, <span class="keyword">true</span>);
+01224 currV = nextV;
+01225 }
+01226 <span class="keywordflow">while</span> (currV != pHighestRight) ;
+01227 }
+01228 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da2" doxytag="NLMISC::CPolygon2D::computeInnerBorders" ></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 NLMISC::CPolygon2D::computeInnerBorders </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw1">TRasterVect</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>borders</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>minimumY</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>
+The same as compute borders, but pixel are seen as surfaces and not as points In this version, only pixels that are entirely INSIDE the poly are kept
+<p>
+Definition at line <a class="el" href="a06190.html#l01618">1618</a> of file <a class="el" href="a06190.html">polygon.cpp</a>.
+<p>
+References <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a06190.html#l01517">NLMISC::ScanInnerEdge()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06191.html#l00160">TRasterVect</a>, <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::x</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>.
+<p>
+<div class="fragment"><pre>01619 {
+01620 <span class="keywordflow">if</span> (<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.empty())
+01621 {
+01622 borders.clear();
+01623 minimumY = -1;
+01624 <span class="keywordflow">return</span>;
+01625 }
+01626 <span class="keyword">const</span> CVector2f *first = &amp;<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[0];
+01627 <span class="keyword">const</span> CVector2f *last = first + Vertices.size();
+01628
+01629 <span class="keyword">const</span> CVector2f *curr = first, *next, *plowest ,*phighest;
+01630 <span class="keyword">const</span> CVector2f *pHighestRight, *pHighestRightNext, *pHighestLeft;
+01631 <span class="keyword">const</span> CVector2f *pPrevHighestLeft;
+01632 <span class="keywordtype">double</span> deltaXN, deltaYN, deltaXP, deltaYP;
+01633 <span class="keywordtype">bool</span> ccw; <span class="comment">// true if CCW oriented</span>
+01634 <a class="code" href="a04558.html#a14">sint</a> polyHeight;
+01635 <a class="code" href="a04558.html#a14">sint</a> highest, lowest;
+01636
+01637 <span class="keywordtype">float</span> fright = curr-&gt;x;
+01638 <span class="keywordtype">float</span> fleft = curr-&gt;x;
+01639 <span class="keywordtype">float</span> fhighest = curr-&gt;y;
+01640 <span class="keywordtype">float</span> flowest = curr-&gt;y;
+01641 plowest = phighest = curr;
+01642
+01643 <span class="comment">// compute highest (with lowest y) and lowest (with highest y) points of the poly</span>
+01644 <span class="keywordflow">do</span>
+01645 {
+01646 fright = std::max(fright, curr-&gt;x);
+01647 fleft = <a class="code" href="a04061.html#a0">std::min</a>(fleft, curr-&gt;x);
+01648 <span class="keywordflow">if</span> (curr-&gt;y &gt; flowest)
+01649 {
+01650 flowest = curr-&gt;y;
+01651 plowest = curr;
+01652 }
+01653 <span class="keywordflow">if</span> (curr-&gt;y &lt; fhighest)
+01654 {
+01655 fhighest = curr-&gt;y;
+01656 phighest = curr;
+01657 }
+01658 ++curr;
+01659 }
+01660 <span class="keywordflow">while</span> (curr != last);
+01661
+01662
+01663 highest = (<a class="code" href="a04558.html#a14">sint</a>) floorf(fhighest);
+01664 lowest = (<a class="code" href="a04558.html#a14">sint</a>) ceilf(flowest);
+01665
+01666 polyHeight = lowest - highest;
+01667 <span class="keywordflow">if</span> (polyHeight == 0) <span class="keywordflow">return</span>;
+01668
+01669 <span class="comment">// make room for rasters</span>
+01670 borders.resize(polyHeight);
+01671 <span class="comment">// fill with xmin / xman</span>
+01672 <a class="code" href="a04558.html#a14">sint</a> ileft = (<a class="code" href="a04558.html#a14">sint</a>) floorf(fleft) - 1;
+01673 <a class="code" href="a04558.html#a14">sint</a> iright = (<a class="code" href="a04558.html#a14">sint</a>) ceilf(fright);
+01674 <span class="keywordflow">for</span>(TRasterVect::iterator it = borders.begin(); it != borders.end(); ++it)
+01675 {
+01676 it-&gt;second = iright;
+01677 it-&gt;first = ileft;
+01678 }
+01679
+01680 minimumY = highest;
+01681 pHighestRight = phighest;
+01682 <span class="keywordflow">for</span> (;;)
+01683 {
+01684 pHighestRightNext = pHighestRight + 1;
+01685 <span class="keywordflow">if</span> (pHighestRightNext == last) pHighestRightNext = first;
+01686 <span class="keywordflow">if</span> (pHighestRightNext-&gt;y != pHighestRight-&gt;y) <span class="keywordflow">break</span>;
+01687 pHighestRight = pHighestRightNext;
+01688 }
+01689
+01690 pPrevHighestLeft = pHighestRight;
+01691 pHighestLeft = pHighestRight;
+01692 ++pHighestLeft;
+01693 <span class="keywordflow">if</span> (pHighestLeft == last) pHighestLeft = first;
+01694
+01695 <span class="keywordflow">while</span> (pHighestLeft-&gt;y != fhighest)
+01696 {
+01697 pPrevHighestLeft = pHighestLeft;
+01698 ++pHighestLeft;
+01699 <span class="keywordflow">if</span> (pHighestLeft == last) pHighestLeft = first;
+01700 }
+01701
+01702
+01703 <span class="comment">// we need to get the orientation of the polygon</span>
+01704 <span class="comment">// There are 2 case : flat, and non-flat top</span>
+01705
+01706 <span class="comment">// check for flat top</span>
+01707 <span class="keywordflow">if</span> (pHighestLeft-&gt;x != pHighestRight-&gt;x)
+01708 {
+01709 <span class="comment">// compare right and left side</span>
+01710 <span class="keywordflow">if</span> (pHighestLeft-&gt;x &gt; pHighestRight-&gt;x)
+01711 {
+01712 ccw = <span class="keyword">true</span>; <span class="comment">// the list is CCW oriented</span>
+01713 std::swap(pHighestLeft, pHighestRight);
+01714 }
+01715 <span class="keywordflow">else</span>
+01716 {
+01717 ccw = <span class="keyword">false</span>; <span class="comment">// the list is CW oriented</span>
+01718 }
+01719 }
+01720 <span class="keywordflow">else</span>
+01721 {
+01722 pHighestRightNext = pHighestRight + 1;
+01723 <span class="keywordflow">if</span> (pHighestRightNext == last) pHighestRightNext = first;
+01724 deltaXN = pHighestRightNext-&gt;x - pHighestRight-&gt;x;
+01725 deltaYN = pHighestRightNext-&gt;y - pHighestRight-&gt;y;
+01726 deltaXP = pPrevHighestLeft-&gt;x - pHighestLeft-&gt;x;
+01727 deltaYP = pPrevHighestLeft-&gt;y - pHighestLeft-&gt;y;
+01728 <span class="keywordflow">if</span> ((deltaXN * deltaYP - deltaYN * deltaXP) &lt; 0)
+01729 {
+01730 ccw = <span class="keyword">true</span>;
+01731 std::swap(pHighestLeft, pHighestRight);
+01732 }
+01733 <span class="keywordflow">else</span>
+01734 {
+01735 ccw = <span class="keyword">false</span>;
+01736 }
+01737 }
+01738
+01739 <span class="keywordflow">if</span> (!ccw)
+01740 {
+01741 <span class="comment">// cw oriented</span>
+01742 curr = pHighestRight;
+01743 <span class="keywordflow">do</span>
+01744 {
+01745 next = curr + 1;
+01746 <span class="keywordflow">if</span> (next == last) next = first;
+01747 <a class="code" href="a05378.html#a350">ScanInnerEdge</a>(&amp;borders[0], curr-&gt;x, curr-&gt;y, next-&gt;x, next-&gt;y, minimumY, <span class="keyword">true</span>);
+01748 curr = next;
+01749 }
+01750 <span class="keywordflow">while</span> (curr != plowest);
+01751 <span class="keywordflow">do</span>
+01752 {
+01753 next = curr + 1;
+01754 <span class="keywordflow">if</span> (next == last) next = first;
+01755 <a class="code" href="a05378.html#a350">ScanInnerEdge</a>(&amp;borders[0], next-&gt;x, next-&gt;y, curr-&gt;x, curr-&gt;y, minimumY, <span class="keyword">false</span>);
+01756 curr = next;
+01757 }
+01758 <span class="keywordflow">while</span> (curr != pHighestLeft);
+01759 }
+01760 <span class="keywordflow">else</span>
+01761 {
+01762 <span class="comment">// ccw oriented</span>
+01763 curr = pHighestLeft;
+01764 <span class="keywordflow">do</span>
+01765 {
+01766 next = curr + 1;
+01767 <span class="keywordflow">if</span> (next == last) next = first;
+01768 <a class="code" href="a05378.html#a350">ScanInnerEdge</a>(&amp;borders[0], curr-&gt;x, curr-&gt;y, next-&gt;x, next-&gt;y, minimumY, <span class="keyword">false</span>);
+01769 curr = next;
+01770 }
+01771 <span class="keywordflow">while</span> (curr != plowest);
+01772 <span class="keywordflow">do</span>
+01773 {
+01774 next = curr + 1;
+01775 <span class="keywordflow">if</span> (next == last) next = first;
+01776 <a class="code" href="a05378.html#a350">ScanInnerEdge</a>(&amp;borders[0], next-&gt;x, next-&gt;y, curr-&gt;x, curr-&gt;y, minimumY, <span class="keyword">true</span>);
+01777 curr = next;
+01778 }
+01779 <span class="keywordflow">while</span> (curr != pHighestRight);
+01780 }
+01781 <span class="comment">// fix for top</span>
+01782 <span class="keywordflow">if</span> (floorf(fhighest) != fhighest)
+01783 {
+01784 borders[0].first = 1;
+01785 borders[0].second = 0;
+01786 }
+01787 <span class="comment">// fix for bottom</span>
+01788 <span class="keywordflow">if</span> (floorf(flowest) != flowest)
+01789 {
+01790 borders.back().first = 1;
+01791 borders.back().second = 0;
+01792 }
+01793 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da3" doxytag="NLMISC::CPolygon2D::computeOuterBorders" ></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 NLMISC::CPolygon2D::computeOuterBorders </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="a03101.html#NLMISC_1_1CPolygon2Dw1">TRasterVect</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>borders</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>minimumY</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>
+The same as compute borders, but pixel are seen as surfaces and not as points. Any pixel that is touched by the poly will be selected
+<p>
+Definition at line <a class="el" href="a06190.html#l01344">1344</a> of file <a class="el" href="a06190.html">polygon.cpp</a>.
+<p>
+References <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06190.html#l01288">NLMISC::ScanOuterEdgeLeft()</a>, <a class="el" href="a06190.html#l01232">NLMISC::ScanOuterEdgeRight()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06191.html#l00160">TRasterVect</a>, <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::x</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>.
+<p>
+<div class="fragment"><pre>01345 {
+01346 <span class="comment">// NB : this version is not much optimized, because of the min/max test</span>
+01347 <span class="comment">// during rasterization.</span>
+01348 <span class="comment">// TODO : optimize if needed ...</span>
+01349
+01350 <span class="keywordflow">if</span> (<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.empty())
+01351 {
+01352 borders.clear();
+01353 minimumY = -1;
+01354 <span class="keywordflow">return</span>;
+01355 }
+01356 <span class="keyword">const</span> CVector2f *first = &amp;<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[0];
+01357 <span class="keyword">const</span> CVector2f *last = first + Vertices.size();
+01358
+01359 <span class="keyword">const</span> CVector2f *curr = first, *next, *plowest ,*phighest;
+01360 <span class="keyword">const</span> CVector2f *pHighestRight, *pHighestRightNext, *pHighestLeft;
+01361 <span class="keyword">const</span> CVector2f *pPrevHighestLeft;
+01362 <span class="keywordtype">double</span> deltaXN, deltaYN, deltaXP, deltaYP;
+01363 <span class="keywordtype">bool</span> ccw; <span class="comment">// true if CCW oriented</span>
+01364 <a class="code" href="a04558.html#a14">sint</a> polyHeight;
+01365 <a class="code" href="a04558.html#a14">sint</a> highest, lowest;
+01366
+01367 <span class="keywordtype">float</span> fright = curr-&gt;x;
+01368 <span class="keywordtype">float</span> fleft = curr-&gt;x;
+01369 <span class="keywordtype">float</span> fhighest = curr-&gt;y;
+01370 <span class="keywordtype">float</span> flowest = curr-&gt;y;
+01371 plowest = phighest = curr;
+01372
+01373 <span class="comment">// compute highest and lowest pos of the poly</span>
+01374 <span class="keywordflow">do</span>
+01375 {
+01376 fright = std::max(fright, curr-&gt;x);
+01377 fleft = <a class="code" href="a04061.html#a0">std::min</a>(fleft, curr-&gt;x);
+01378 <span class="keywordflow">if</span> (curr-&gt;y &gt; flowest)
+01379 {
+01380 flowest = curr-&gt;y;
+01381 plowest = curr;
+01382 }
+01383 <span class="keywordflow">if</span> (curr-&gt;y &lt; fhighest)
+01384 {
+01385 fhighest = curr-&gt;y;
+01386 phighest = curr;
+01387 }
+01388 ++curr;
+01389 }
+01390 <span class="keywordflow">while</span> (curr != last);
+01391
+01392
+01393 highest = (<a class="code" href="a04558.html#a14">sint</a>) floorf(fhighest);
+01394 lowest = (<a class="code" href="a04558.html#a14">sint</a>) floorf(flowest);
+01395
+01396 polyHeight = lowest - highest + 1;
+01397 <a class="code" href="a04199.html#a6">nlassert</a>(polyHeight &gt; 0);
+01398
+01399 <span class="comment">// make room for rasters</span>
+01400 borders.resize(polyHeight);
+01401 <span class="comment">// fill with xmin / xman</span>
+01402 <a class="code" href="a04558.html#a14">sint</a> ileft = (<a class="code" href="a04558.html#a14">sint</a>) floorf(fleft);
+01403 <a class="code" href="a04558.html#a14">sint</a> iright = (<a class="code" href="a04558.html#a14">sint</a>) ceilf(fright);
+01404 <span class="keywordflow">for</span>(TRasterVect::iterator it = borders.begin(); it != borders.end(); ++it)
+01405 {
+01406 it-&gt;second = ileft;
+01407 it-&gt;first = iright;
+01408 }
+01409
+01410
+01411 minimumY = highest;
+01412 pHighestRight = phighest;
+01413 <span class="keywordflow">for</span> (;;)
+01414 {
+01415 pHighestRightNext = pHighestRight + 1;
+01416 <span class="keywordflow">if</span> (pHighestRightNext == last) pHighestRightNext = first;
+01417 <span class="keywordflow">if</span> (pHighestRightNext-&gt;y != pHighestRight-&gt;y) <span class="keywordflow">break</span>;
+01418 pHighestRight = pHighestRightNext;
+01419 }
+01420
+01421 pPrevHighestLeft = pHighestRight;
+01422 pHighestLeft = pHighestRight;
+01423 ++pHighestLeft;
+01424 <span class="keywordflow">if</span> (pHighestLeft == last) pHighestLeft = first;
+01425
+01426 <span class="keywordflow">while</span> (pHighestLeft-&gt;y != fhighest)
+01427 {
+01428 pPrevHighestLeft = pHighestLeft;
+01429 ++pHighestLeft;
+01430 <span class="keywordflow">if</span> (pHighestLeft == last) pHighestLeft = first;
+01431 }
+01432
+01433
+01434 <span class="comment">// we need to get the orientation of the polygon</span>
+01435 <span class="comment">// There are 2 case : flat, and non-flat top</span>
+01436
+01437 <span class="comment">// check for flat top</span>
+01438 <span class="keywordflow">if</span> (pHighestLeft-&gt;x != pHighestRight-&gt;x)
+01439 {
+01440 <span class="comment">// compare right and left side</span>
+01441 <span class="keywordflow">if</span> (pHighestLeft-&gt;x &gt; pHighestRight-&gt;x)
+01442 {
+01443 ccw = <span class="keyword">true</span>; <span class="comment">// the list is CCW oriented</span>
+01444 std::swap(pHighestLeft, pHighestRight);
+01445 }
+01446 <span class="keywordflow">else</span>
+01447 {
+01448 ccw = <span class="keyword">false</span>; <span class="comment">// the list is CW oriented</span>
+01449 }
+01450 }
+01451 <span class="keywordflow">else</span>
+01452 {
+01453 pHighestRightNext = pHighestRight + 1;
+01454 <span class="keywordflow">if</span> (pHighestRightNext == last) pHighestRightNext = first;
+01455 deltaXN = pHighestRightNext-&gt;x - pHighestRight-&gt;x;
+01456 deltaYN = pHighestRightNext-&gt;y - pHighestRight-&gt;y;
+01457 deltaXP = pPrevHighestLeft-&gt;x - pHighestLeft-&gt;x;
+01458 deltaYP = pPrevHighestLeft-&gt;y - pHighestLeft-&gt;y;
+01459 <span class="keywordflow">if</span> ((deltaXN * deltaYP - deltaYN * deltaXP) &lt; 0)
+01460 {
+01461 ccw = <span class="keyword">true</span>;
+01462 std::swap(pHighestLeft, pHighestRight);
+01463 }
+01464 <span class="keywordflow">else</span>
+01465 {
+01466 ccw = <span class="keyword">false</span>;
+01467 }
+01468 }
+01469
+01470 <span class="keywordflow">if</span> (!ccw)
+01471 {
+01472 <span class="comment">// clock wise oriented list </span>
+01473 curr = pHighestRight;
+01474 <span class="keywordflow">do</span>
+01475 {
+01476 next = curr + 1;
+01477 <span class="keywordflow">if</span> (next == last) next = first;
+01478 <a class="code" href="a05378.html#a348">ScanOuterEdgeRight</a>(&amp;borders[0], curr-&gt;x, curr-&gt;y, next-&gt;x, next-&gt;y, minimumY);
+01479 curr = next;
+01480 }
+01481 <span class="keywordflow">while</span> (curr != plowest);
+01482 <span class="keywordflow">do</span>
+01483 {
+01484 next = curr + 1;
+01485 <span class="keywordflow">if</span> (next == last) next = first;
+01486 <a class="code" href="a05378.html#a349">ScanOuterEdgeLeft</a>(&amp;borders[0], next-&gt;x, next-&gt;y, curr-&gt;x, curr-&gt;y, minimumY);
+01487 curr = next;
+01488 }
+01489 <span class="keywordflow">while</span> (curr != pHighestLeft);
+01490 }
+01491 <span class="keywordflow">else</span>
+01492 {
+01493 <span class="comment">// ccw oriented </span>
+01494 curr = pHighestLeft;
+01495 <span class="keywordflow">do</span>
+01496 {
+01497 next = curr + 1;
+01498 <span class="keywordflow">if</span> (next == last) next = first;
+01499 <a class="code" href="a05378.html#a349">ScanOuterEdgeLeft</a>(&amp;borders[0], curr-&gt;x, curr-&gt;y, next-&gt;x, next-&gt;y, minimumY);
+01500 curr = next;
+01501 }
+01502 <span class="keywordflow">while</span> (curr != plowest);
+01503 <span class="keywordflow">do</span>
+01504 {
+01505 next = curr + 1;
+01506 <span class="keywordflow">if</span> (next == last) next = first;
+01507 <a class="code" href="a05378.html#a348">ScanOuterEdgeRight</a>(&amp;borders[0], next-&gt;x, next-&gt;y, curr-&gt;x, curr-&gt;y, minimumY);
+01508 curr = next;
+01509 }
+01510 <span class="keywordflow">while</span> (curr != pHighestRight);
+01511 }
+01512 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da4" doxytag="NLMISC::CPolygon2D::contains" ></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 NLMISC::CPolygon2D::contains </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const <a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>p</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap> const</td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Check wether a point is contained by this poly.
+<p>
+get the orientation of this poly<p>
+contains the seg 2d equation<p>
+don't check against a null segment<p>
+get the line equation of the current segment<p>
+contains the seg 2d equation
+<p>
+Definition at line <a class="el" href="a06190.html#l01896">1896</a> of file <a class="el" href="a06190.html">polygon.cpp</a>.
+<p>
+References <a class="el" href="a06190.html#l01844">getLineEquation()</a>, <a class="el" href="a06190.html#l01810">getNonNullSeg()</a>, <a class="el" href="a06191.html#l00197">getSegRef0()</a>, <a class="el" href="a06191.html#l00201">getSegRef1()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::x</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>.
+<p>
+Referenced by <a class="el" href="a06190.html#l01857">intersect()</a>.
+<p>
+<div class="fragment"><pre>01897 {
+01898 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size() &gt; 0);
+01899 <a class="code" href="a04558.html#a15">uint</a> nonNullSegIndex;
+01901 <span class="keywordflow">if</span> (<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Da10">getNonNullSeg</a>(nonNullSegIndex))
+01902 {
+01903 <span class="keywordtype">float</span> a0, b0, c0;
+01904 <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Da9">getLineEquation</a>(nonNullSegIndex, a0, b0, c0);
+01905
+01906 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> k = 0; k &lt; <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size(); ++k)
+01907 {
+01909 <span class="keywordflow">if</span> ( (<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Dd0">getSegRef0</a>(k) - <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Dd1">getSegRef1</a>(k)).sqrnorm() == 0.f) <span class="keywordflow">continue</span>;
+01910
+01912 <span class="keywordtype">float</span> a, b, c;
+01913 <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Da9">getLineEquation</a>(k, a, b, c);
+01914
+01915 <span class="keywordflow">if</span> (a * p.x + b * p.y + c &lt; 0) <span class="keywordflow">return</span> <span class="keyword">false</span>;
+01916
+01917 }
+01918 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+01919 }
+01920 <span class="keywordflow">else</span> <span class="comment">// this poly is just a point</span>
+01921 {
+01922 <span class="keywordflow">return</span> p == <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[0];
+01923 }
+01924 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da8" doxytag="NLMISC::CPolygon2D::getBestTriplet" ></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 NLMISC::CPolygon2D::getBestTriplet </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>index0</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>index1</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>index2</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 best triplet of vector. e.g the triplet that has the best surface
+<p>
+
+<p>
+Definition at line <a class="el" href="a06190.html#l00967">967</a> of file <a class="el" href="a06190.html">polygon.cpp</a>.
+<p>
+References <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::x</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>.
+<p>
+<div class="fragment"><pre>00968 {
+00969 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size() &gt;= 3);
+00970 <a class="code" href="a04558.html#a15">uint</a> i, j, k;
+00971 <span class="keywordtype">float</span> bestArea = 0.f;
+00972 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> numVerts = <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size();
+00973 <span class="keywordflow">for</span> (i = 0; i &lt; numVerts; ++i)
+00974 {
+00975 <span class="keywordflow">for</span> (j = 0; j &lt; numVerts; ++j)
+00976 {
+00977 <span class="keywordflow">if</span> (i != j)
+00978 {
+00979 <span class="keywordflow">for</span> (k = 0; k &lt; numVerts; ++k)
+00980 {
+00981 <span class="keywordflow">if</span> (k != i &amp;&amp; k != j)
+00982 {
+00983 CVector2f v0 = <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[j] - Vertices[i];
+00984 CVector2f v1 = Vertices[k] - Vertices[i];
+00985 <span class="keywordtype">float</span> area = fabsf((CVector(v0.x, v0.y, 0) ^ CVector(v1.x, v1.y, 0)).norm());
+00986 <span class="keywordflow">if</span> (area &gt; bestArea)
+00987 {
+00988 bestArea = area;
+00989 index0 = i;
+00990 index1 = j;
+00991 index2 = k;
+00992 }
+00993 }
+00994 }
+00995 }
+00996 }
+00997 }
+00998 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da9" doxytag="NLMISC::CPolygon2D::getLineEquation" ></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 NLMISC::CPolygon2D::getLineEquation </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>index</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>float &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>a</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>float &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>b</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>float &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>c</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"> const</td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get a line equation of the seg starting at the given index.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06190.html#l01844">1844</a> of file <a class="el" href="a06190.html">polygon.cpp</a>.
+<p>
+References <a class="el" href="a06191.html#l00197">getSegRef0()</a>, <a class="el" href="a06191.html#l00201">getSegRef1()</a>, <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::x</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>.
+<p>
+Referenced by <a class="el" href="a06190.html#l01896">contains()</a>, and <a class="el" href="a06190.html#l01857">intersect()</a>.
+<p>
+<div class="fragment"><pre>01845 {
+01846 <a class="code" href="a04199.html#a6">nlassert</a>(index &lt; <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size());
+01847 <span class="keyword">const</span> CVector2f &amp;v0 = <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Dd0">getSegRef0</a>(index);
+01848 <span class="keyword">const</span> CVector2f &amp;v1 = <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Dd1">getSegRef1</a>(index);
+01849
+01850 <a class="code" href="a03660.html">NLMISC::CVector2f</a> seg = v0 - v1;
+01851 a = seg.<a class="code" href="a03660.html#NLMISC_1_1CVector2fo1">y</a>;
+01852 b = - seg.<a class="code" href="a03660.html#NLMISC_1_1CVector2fo0">x</a>;
+01853 c = - v0.x * a - v0.y * b;
+01854 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da10" doxytag="NLMISC::CPolygon2D::getNonNullSeg" ></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 NLMISC::CPolygon2D::getNonNullSeg </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>seg</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap> const</td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get the index of a segment of this poly that is a non null segment. <dl compact><dt><b>Returns:</b></dt><dd>true if such a segment was found</dd></dl>
+
+<p>
+Definition at line <a class="el" href="a06190.html#l01810">1810</a> of file <a class="el" href="a06190.html">polygon.cpp</a>.
+<p>
+References <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05981.html#l00104">sint</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
+<p>
+Referenced by <a class="el" href="a06190.html#l01896">contains()</a>, and <a class="el" href="a06190.html#l01857">intersect()</a>.
+<p>
+<div class="fragment"><pre>01811 {
+01812 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size() &gt; 0);
+01813 <span class="keywordtype">float</span> bestLength = 0.f;
+01814 <a class="code" href="a04558.html#a14">sint</a> bestIndex = -1;
+01815 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> k = 0; k &lt; <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size() - 1; ++k)
+01816 {
+01817 <span class="keywordtype">float</span> norm2 = (<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[k + 1] - Vertices[k]).sqrnorm();
+01818 <span class="keywordflow">if</span> ( norm2 &gt; bestLength)
+01819 {
+01820 bestLength = norm2;
+01821 bestIndex = (<span class="keywordtype">int</span>) k;
+01822 }
+01823 }
+01824 <span class="keywordtype">float</span> norm2 = (<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[Vertices.size() - 1] - Vertices[0]).sqrnorm();
+01825 <span class="keywordflow">if</span> ( norm2 &gt; bestLength)
+01826 {
+01827 <a class="code" href="a04223.html#a566">index</a> = Vertices.size() - 1;
+01828 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+01829 }
+01830
+01831 <span class="keywordflow">if</span> (bestIndex != -1)
+01832 {
+01833 <a class="code" href="a04223.html#a566">index</a> = bestIndex;
+01834 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+01835 }
+01836 <span class="keywordflow">else</span>
+01837 {
+01838 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+01839 }
+01840 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Dd0" doxytag="NLMISC::CPolygon2D::getSegRef0" ></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 <a class="el" href="a03660.html">CVector2f</a>&amp; NLMISC::CPolygon2D::getSegRef0 </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>index</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap> const<code> [inline, private]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get ref to the first vertex that start at index.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06191.html#l00197">197</a> of file <a class="el" href="a06191.html">polygon.h</a>.
+<p>
+References <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
+<p>
+Referenced by <a class="el" href="a06190.html#l01896">contains()</a>, <a class="el" href="a06190.html#l01844">getLineEquation()</a>, and <a class="el" href="a06190.html#l01857">intersect()</a>.
+<p>
+<div class="fragment"><pre>00198 {
+00199 <a class="code" href="a04199.html#a6">nlassert</a>(index &lt; <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size()); <span class="keywordflow">return</span> <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[<a class="code" href="a04223.html#a566">index</a>];
+00200 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Dd1" doxytag="NLMISC::CPolygon2D::getSegRef1" ></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 <a class="el" href="a03660.html">CVector2f</a>&amp; NLMISC::CPolygon2D::getSegRef1 </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>index</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap> const<code> [inline, private]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a06191.html#l00201">201</a> of file <a class="el" href="a06191.html">polygon.h</a>.
+<p>
+References <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
+<p>
+Referenced by <a class="el" href="a06190.html#l01896">contains()</a>, <a class="el" href="a06190.html#l01844">getLineEquation()</a>, and <a class="el" href="a06190.html#l01857">intersect()</a>.
+<p>
+<div class="fragment"><pre>00202 {
+00203 <a class="code" href="a04199.html#a6">nlassert</a>(index &lt; <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size());
+00204 <span class="keywordflow">return</span> <a class="code" href="a04223.html#a566">index</a> == <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size() - 1 ?
+00205 <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[0] :
+00206 <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[<a class="code" href="a04223.html#a566">index</a> + 1];
+00207 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da11" doxytag="NLMISC::CPolygon2D::intersect" ></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 NLMISC::CPolygon2D::intersect </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const <a class="el" href="a03101.html">CPolygon2D</a> &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>other</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap> const</td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Test wether this polygon intersect another convex polygon. Currently not optimized.
+<p>
+get the orientation of this poly<p>
+contains the seg 2d equation<p>
+don't check against a null segment<p>
+get the line equation of the current segment<p>
+contains the seg 2d equation
+<p>
+Definition at line <a class="el" href="a06190.html#l01857">1857</a> of file <a class="el" href="a06190.html">polygon.cpp</a>.
+<p>
+References <a class="el" href="a06190.html#l01896">contains()</a>, <a class="el" href="a06190.html#l01844">getLineEquation()</a>, <a class="el" href="a06190.html#l01810">getNonNullSeg()</a>, <a class="el" href="a06191.html#l00197">getSegRef0()</a>, <a class="el" href="a06191.html#l00201">getSegRef1()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06190.html#l01797">sumDPAgainstLine()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06191.html#l00126">Vertices</a>, <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::x</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>.
+<p>
+Referenced by <a class="el" href="a06768.html#l03563">NL3D::CZoneLighter::computeTileFlagsForPositionTowardWater()</a>.
+<p>
+<div class="fragment"><pre>01858 {
+01859 <a class="code" href="a04199.html#a6">nlassert</a>(other.Vertices.size() &gt; 0);
+01860 <a class="code" href="a04558.html#a15">uint</a> nonNullSegIndex;
+01862 <span class="keywordflow">if</span> (<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Da10">getNonNullSeg</a>(nonNullSegIndex))
+01863 {
+01864 <span class="keywordtype">float</span> a0, b0, c0;
+01865 <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Da9">getLineEquation</a>(nonNullSegIndex, a0, b0, c0);
+01866 <span class="keywordtype">float</span> orient = <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Dd2">sumDPAgainstLine</a>(a0, b0, c0);
+01867
+01868 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> k = 0; k &lt; <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size(); ++k)
+01869 {
+01871 <span class="keywordflow">if</span> ( (<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Dd0">getSegRef0</a>(k) - <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Dd1">getSegRef1</a>(k)).sqrnorm() == 0.f) <span class="keywordflow">continue</span>;
+01872
+01874 <span class="keywordtype">float</span> a, b, c;
+01875 <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Da9">getLineEquation</a>(k, a, b, c);
+01876 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a05373.html#a2">l</a>;
+01877 <span class="keywordflow">for</span> (<a class="code" href="a05373.html#a2">l</a> = 0; <a class="code" href="a05373.html#a2">l</a> &lt; other.Vertices.size(); ++<a class="code" href="a05373.html#a2">l</a>)
+01878 {
+01879 <span class="keyword">const</span> CVector2f &amp;ov = other.Vertices[<a class="code" href="a05373.html#a2">l</a>];
+01880 <span class="keywordflow">if</span> ( orient * (ov.x * a + ov.y * b +c) &gt; 0.f) <span class="keywordflow">break</span>;
+01881 }
+01882 <span class="keywordflow">if</span> (<a class="code" href="a05373.html#a2">l</a> == other.Vertices.size()) <span class="comment">// all point on the outside</span>
+01883 {
+01884 <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// outside</span>
+01885 }
+01886 }
+01887 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+01888 }
+01889 <span class="keywordflow">else</span> <span class="comment">// this poly is just a point</span>
+01890 {
+01891 <span class="keywordflow">return</span> other.contains(Vertices[0]);
+01892 }
+01893 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da12" doxytag="NLMISC::CPolygon2D::isConvex" ></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 NLMISC::CPolygon2D::isConvex </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></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Check wether this polygon is convex;.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06190.html#l00798">798</a> of file <a class="el" href="a06190.html">polygon.cpp</a>.
+<p>
+References <a class="el" href="a06170.html#l00036">NLMISC::CPlane::make()</a>, <a class="el" href="a06682.html#l00136">NLMISC::CVector::set()</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>00799 {
+00800 <span class="keywordtype">bool</span> Front = <span class="keyword">true</span>, Back = <span class="keyword">false</span>;
+00801 <span class="comment">// we apply a dummy algo for now : check wether every vertex is in the same side </span>
+00802 <span class="comment">// of every plane defined by a segment of this poly</span>
+00803 <a class="code" href="a04558.html#a15">uint</a> numVerts = <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size();
+00804 <span class="keywordflow">if</span> (numVerts &lt; 3) <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00805 CVector segStart, segEnd;
+00806 CPlane clipPlane;
+00807 <span class="keywordflow">for</span> (TVec2fVect::const_iterator it = <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.begin(); it != <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.end(); ++it)
+00808 {
+00809 segStart.set(it-&gt;x, it-&gt;y, 0); <span class="comment">// segment start</span>
+00810 segEnd.set((it + 1)-&gt;<a class="code" href="a04223.html#a572">x</a>, (it + 1)-&gt;<a class="code" href="a04223.html#a573">y</a>, 0); <span class="comment">// segment end</span>
+00811 <span class="keywordtype">float</span> n = (segStart - segEnd).norm(); <span class="comment">// segment norm</span>
+00812 <span class="keywordflow">if</span> (n != 0)
+00813 {
+00814 clipPlane.make(segStart, segEnd, (n &gt; 10 ? n : 10) * CVector::K + segStart); <span class="comment">// make a plane, with this segment and the poly normal</span>
+00815 <span class="comment">// check each other vertices against this plane</span>
+00816 <span class="keywordflow">for</span> (TVec2fVect::const_iterator it2 = <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.begin(); it2 != <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.end(); ++it2)
+00817 {
+00818 <span class="keywordflow">if</span> (it2 != it &amp;&amp; it2 != (it + 1)) <span class="comment">// the vertices must not be part of the test plane (because of imprecision)</span>
+00819 {
+00820
+00821 <span class="keywordtype">float</span> dist = clipPlane * CVector(it2-&gt;x, it2-&gt; <a class="code" href="a04223.html#a573">y</a>, 0);
+00822 <span class="keywordflow">if</span> (dist != 0) <span class="comment">// midlle pos</span>
+00823 {
+00824 <span class="keywordflow">if</span> (dist &gt; 0) Front = <span class="keyword">true</span>; <span class="keywordflow">else</span> Back = <span class="keyword">true</span>;
+00825 <span class="keywordflow">if</span> (Front &amp;&amp; Back) <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// there are both front end back vertices -&gt; failure</span>
+00826 }
+00827 }
+00828 }
+00829 }
+00830 }
+00831 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00832 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da13" doxytag="NLMISC::CPolygon2D::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 NLMISC::CPolygon2D::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>f</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap> throw (<a class="el" href="a03781.html">NLMISC::EStream</a>)</td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Serial this polygon.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06190.html#l00959">959</a> of file <a class="el" href="a06190.html">polygon.cpp</a>.
+<p>
+<div class="fragment"><pre>00960 {
+00961 (<span class="keywordtype">void</span>)f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_8">serialVersion</a>(0);
+00962 f.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a>(Vertices);
+00963 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Dd2" doxytag="NLMISC::CPolygon2D::sumDPAgainstLine" ></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"> float NLMISC::CPolygon2D::sumDPAgainstLine </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">float&nbsp;</td>
+ <td class="mdname" nowrap> <em>a</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>b</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>c</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"> const<code> [private]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Sum the dot product of this poly vertices against a plane.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06190.html#l01797">1797</a> of file <a class="el" href="a06190.html">polygon.cpp</a>.
+<p>
+References <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::x</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>.
+<p>
+Referenced by <a class="el" href="a06190.html#l01857">intersect()</a>.
+<p>
+<div class="fragment"><pre>01798 {
+01799 <span class="keywordtype">float</span> sum = 0.f;
+01800 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> k = 0; k &lt; <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.size(); ++k)
+01801 {
+01802 <span class="keyword">const</span> CVector2f &amp;p = <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[k];
+01803 sum += a * p.x + b * p.y + c;
+01804 }
+01805 <span class="keywordflow">return</span> sum;
+01806 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CPolygon2Da14" doxytag="NLMISC::CPolygon2D::swap" ></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 NLMISC::CPolygon2D::swap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="a03101.html">CPolygon2D</a> &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>other</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [inline]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a06191.html#l00132">132</a> of file <a class="el" href="a06191.html">polygon.h</a>.
+<p>
+References <a class="el" href="a06191.html#l00126">Vertices</a>.
+<p>
+<div class="fragment"><pre>00132 { <a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.swap(other.Vertices); }
+</pre></div> </td>
+ </tr>
+</table>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="NLMISC_1_1CPolygon2Do0" doxytag="NLMISC::CPolygon2D::Vertices" ></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="a03101.html#NLMISC_1_1CPolygon2Dw2">TVec2fVect</a> <a class="el" href="a03101.html#NLMISC_1_1CPolygon2Do0">NLMISC::CPolygon2D::Vertices</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a06191.html#l00126">126</a> of file <a class="el" href="a06191.html">polygon.h</a>.
+<p>
+Referenced by <a class="el" href="a06190.html#l00836">buildConvexHull()</a>, <a class="el" href="a05937.html#l00066">NL3D::CLodCharacterShapeBuild::compile()</a>, <a class="el" href="a06741.html#l00410">NL3D::CWaterShape::computeBBox()</a>, <a class="el" href="a06737.html#l01054">NL3D::CWaterModel::computeClippedPoly()</a>, <a class="el" href="a06737.html#l01026">NL3D::CWaterModel::computeSimpleClippedPoly()</a>, <a class="el" href="a06768.html#l03563">NL3D::CZoneLighter::computeTileFlagsForPositionTowardWater()</a>, <a class="el" href="a06737.html#l01170">NL3D::CWaterModel::doSimpleRender()</a>, <a class="el" href="a06741.html#l00609">NL3D::CWaterShape::getShapeInWorldSpace()</a>, <a class="el" href="a06190.html#l01857">intersect()</a>, <a class="el" href="a06190.html#l01945">NLMISC::operator&lt;()</a>, <a class="el" href="a06190.html#l01938">NLMISC::operator==()</a>, <a class="el" href="a06768.html#l00444">RenderTriangle()</a>, <a class="el" href="a06741.html#l00401">NL3D::CWaterShape::setShape()</a>, <a class="el" href="a06191.html#l00132">swap()</a>, and <a class="el" href="a06737.html#l00437">NL3D::CWaterModel::traverseRender()</a>. </td>
+ </tr>
+</table>
+<hr>The documentation for this class was generated from the following files:<ul>
+<li><a class="el" href="a06191.html">polygon.h</a><li><a class="el" href="a06190.html">polygon.cpp</a></ul>
+<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 13:28:15 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>