aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a02968.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--docs/doxygen/nel/a02968.html306
1 files changed, 306 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02968.html b/docs/doxygen/nel/a02968.html
new file mode 100644
index 00000000..36112a69
--- /dev/null
+++ b/docs/doxygen/nel/a02968.html
@@ -0,0 +1,306 @@
+<!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: NL3D::CMRMSewingMesh 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>NL3D::CMRMSewingMesh Class Reference</h1><code>#include &lt;<a class="el" href="a06058.html">mrm_internal.h</a>&gt;</code>
+<p>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+An internal polygon with LOD information for Interface system
+<p>
+
+<p>
+Definition at line <a class="el" href="a06058.html#l00327">327</a> of file <a class="el" href="a06058.html">mrm_internal.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>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02968.html#NL3D_1_1CMRMSewingMesha0">build</a> (const <a class="el" href="a02861.html">CMesh::CInterface</a> &amp;meshInt, <a class="el" href="a04558.html#a15">uint</a> nWantedLods, <a class="el" href="a04558.html#a15">uint</a> divisor)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02968.html#NL3D_1_1CMRMSewingMesha1">getNumCollapseEdge</a> (<a class="el" href="a04558.html#a15">uint</a> lod) const </td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">get the number of edge to collapse for a lod <a href="#NL3D_1_1CMRMSewingMesha1"></a><br><br></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02968.html#NL3D_1_1CMRMSewingMesha2">mustCollapseEdge</a> (<a class="el" href="a04558.html#a15">uint</a> lod, const <a class="el" href="a02955.html">CMRMEdge</a> &amp;edge, <a class="el" href="a04558.html#a15">uint</a> &amp;vertToCollapse) const </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="a02969.html">CLod</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02968.html#NL3D_1_1CMRMSewingMeshr0">_Lods</a></td></tr>
+
+</table>
+<hr><h2>Member Function Documentation</h2>
+<a class="anchor" name="NL3D_1_1CMRMSewingMesha0" doxytag="NL3D::CMRMSewingMesh::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"> void NL3D::CMRMSewingMesh::build </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const <a class="el" href="a02861.html">CMesh::CInterface</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>meshInt</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>&nbsp;</td>
+ <td class="mdname" nowrap> <em>nWantedLods</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>&nbsp;</td>
+ <td class="mdname" nowrap> <em>divisor</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 a MRM sewing mesh from a CMeshBuild interface.
+<p>
+Definition at line <a class="el" href="a06057.html#l00067">67</a> of file <a class="el" href="a06057.html">mrm_internal.cpp</a>.
+<p>
+References <a class="el" href="a06682.html#l00115">NLMISC::CVector::norm()</a>, <a class="el" href="a06682.html#l00119">NLMISC::CVector::normalize()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05990.html#l00156">NL3D::CMesh::CInterface::Vertices</a>.
+<p>
+<div class="fragment"><pre>00068 {
+00069 <span class="comment">/* The polygon is MRM-egde-like reduced (pop an edge when needed)</span>
+00070 <span class="comment"> At each lod we store what edge is collapsed.</span>
+00071 <span class="comment"> */</span>
+00072 <a class="code" href="a02968.html#NL3D_1_1CMRMSewingMeshr0">_Lods</a>.clear();
+00073 <a class="code" href="a02968.html#NL3D_1_1CMRMSewingMeshr0">_Lods</a>.resize(nWantedLods);
+00074
+00075 <span class="comment">// build edge list</span>
+00076 std::vector&lt;CMRMEdge&gt; edgeList;
+00077 <a class="code" href="a04558.html#a15">uint</a> nMaxEdges= meshInt.Vertices.size();
+00078 edgeList.resize(nMaxEdges);
+00079 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0;i&lt;nMaxEdges;i++)
+00080 {
+00081 edgeList[i].v0= i;
+00082 edgeList[i].v1= (i+1)%nMaxEdges;
+00083 }
+00084
+00085 <span class="comment">// build how many edges the coarsest lod will have. At least 3 edge for a correct cross section</span>
+00086 <a class="code" href="a04558.html#a14">sint</a> nBaseEdges= nMaxEdges/divisor;
+00087 nBaseEdges=max(nBaseEdges,3);
+00088
+00089 <span class="comment">// must fill all LODs, from end to start. do not proces last lod since it will be the coarsest mesh (no collapse)</span>
+00090 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> lod=nWantedLods-1;lod&gt;0;lod--)
+00091 {
+00092 <span class="comment">// Linear.</span>
+00093 <a class="code" href="a04558.html#a14">sint</a> nCurEdges= (<a class="code" href="a04558.html#a14">sint</a>)floor( 0.5f + nBaseEdges + (nMaxEdges-nBaseEdges) * (<span class="keywordtype">float</span>)(lod-1)/(nWantedLods-1) );
+00094 nCurEdges=max(nCurEdges,3);
+00095
+00096 <span class="comment">// the current edge list is reduced until same size as wanted</span>
+00097 <span class="keywordflow">while</span>(nCurEdges&lt;(<a class="code" href="a04558.html#a14">sint</a>)edgeList.size())
+00098 {
+00099 <span class="comment">// search the smallest edge</span>
+00100 <span class="keywordtype">float</span> bestDist= FLT_MAX;
+00101 <a class="code" href="a04558.html#a15">uint</a> bestEdgeId= 0;
+00102 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> j=0;j&lt;edgeList.size();j++)
+00103 {
+00104 <a class="code" href="a04558.html#a15">uint</a> precEdgeId= (j + edgeList.size() -1) % edgeList.size();
+00105 CVector edgeDelta= (meshInt.Vertices[edgeList[j].v1].Pos - meshInt.Vertices[edgeList[j].v0].Pos);
+00106
+00107 <span class="comment">// compute dist between 2 verts</span>
+00108 <span class="keywordtype">float</span> dist= edgeDelta.norm();
+00109
+00110 <span class="comment">// compute dir of prec and cur edges</span>
+00111 CVector curEdgeDir= edgeDelta;
+00112 CVector precEdgeDir= (meshInt.Vertices[edgeList[precEdgeId].v1].Pos - meshInt.Vertices[edgeList[precEdgeId].v0].Pos);
+00113 curEdgeDir.normalize();
+00114 precEdgeDir.normalize();
+00115
+00116 <span class="comment">// compute how linear they are from -1 to 1.</span>
+00117 <span class="keywordtype">float</span> angularPart= curEdgeDir * precEdgeDir;
+00118
+00119 <span class="comment">/* The more the edge is linear to the previous edge, the more we can collapse it.</span>
+00120 <span class="comment"> If totaly linear (curEdgeDir*precEdgeDir==1), it should be a good idea to collapse it now.</span>
+00121 <span class="comment"> But the fact is that this is an interface and we don't know what kind of mesh share those edges</span>
+00122 <span class="comment"> (I mean it is possible that neighbors faces are absolutely not coplanar).</span>
+00123 <span class="comment"> So don't add to much importance on Angular Part</span>
+00124 <span class="comment"> */</span>
+00125 <span class="keyword">const</span> <span class="keywordtype">float</span> angularBias= 1; <span class="comment">// if 0, 2 linear edges will collapse asap.</span>
+00126 dist*= angularBias + 1-angularPart;
+00127
+00128 <span class="comment">// take min dist</span>
+00129 <span class="keywordflow">if</span>(dist&lt;bestDist)
+00130 {
+00131 bestDist= dist;
+00132 bestEdgeId= j;
+00133 }
+00134 }
+00135
+00136 <span class="comment">// mark as remove it</span>
+00137 <a class="code" href="a02968.html#NL3D_1_1CMRMSewingMeshr0">_Lods</a>[lod].EdgeToCollapse.push_back(edgeList[bestEdgeId]);
+00138 <span class="comment">// changes vert ids of the prec edge. eg: edge(12) is deleted=&gt; 01 12 23... becomes 02 23 (NB: 1 is collapsed to 2)</span>
+00139 <a class="code" href="a04558.html#a15">uint</a> precEdgeId= (bestEdgeId+edgeList.size()-1)%edgeList.size();
+00140 edgeList[precEdgeId].v1= edgeList[bestEdgeId].v1;
+00141 <span class="comment">// and erase the edge from the current list</span>
+00142 edgeList.erase( edgeList.begin()+bestEdgeId );
+00143 }
+00144 }
+00145
+00146 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NL3D_1_1CMRMSewingMesha1" doxytag="NL3D::CMRMSewingMesh::getNumCollapseEdge" ></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#a14">sint</a> NL3D::CMRMSewingMesh::getNumCollapseEdge </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>lod</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 number of edge to collapse for a lod
+<p>
+
+<p>
+Definition at line <a class="el" href="a06057.html#l00059">59</a> of file <a class="el" href="a06057.html">mrm_internal.cpp</a>.
+<p>
+References <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="a06055.html#l00244">NL3D::CMRMBuilder::computeEdgeCost()</a>.
+<p>
+<div class="fragment"><pre>00060 {
+00061 <a class="code" href="a04199.html#a6">nlassert</a>(lod&lt;<a class="code" href="a02968.html#NL3D_1_1CMRMSewingMeshr0">_Lods</a>.size());
+00062 <span class="keywordflow">return</span> <a class="code" href="a02968.html#NL3D_1_1CMRMSewingMeshr0">_Lods</a>[lod].EdgeToCollapse.size();
+00063 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NL3D_1_1CMRMSewingMesha2" doxytag="NL3D::CMRMSewingMesh::mustCollapseEdge" ></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#a14">sint</a> NL3D::CMRMSewingMesh::mustCollapseEdge </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>lod</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>const <a class="el" href="a02955.html">CMRMEdge</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>edge</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>vertToCollapse</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>
+&gt;=0 if the lod has this edge to collapse. -1 else. NB: order of collapse is returned. <dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign=top><em>vertToCollapse</em>&nbsp;</td><td>is the vertex id which must be collapsed to the other (ie the one which moves/dissapear)</td></tr>
+ </table>
+</dl>
+
+<p>
+Definition at line <a class="el" href="a06057.html#l00041">41</a> of file <a class="el" href="a06057.html">mrm_internal.cpp</a>.
+<p>
+References <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="a06055.html#l00499">NL3D::CMRMBuilder::collapseEdge()</a>, and <a class="el" href="a06055.html#l00244">NL3D::CMRMBuilder::computeEdgeCost()</a>.
+<p>
+<div class="fragment"><pre>00042 {
+00043 <a class="code" href="a04199.html#a6">nlassert</a>(lod&lt;<a class="code" href="a02968.html#NL3D_1_1CMRMSewingMeshr0">_Lods</a>.size());
+00044 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0;i&lt;<a class="code" href="a02968.html#NL3D_1_1CMRMSewingMeshr0">_Lods</a>[lod].EdgeToCollapse.size();i++)
+00045 {
+00046 <span class="keywordflow">if</span>(edge==_Lods[lod].EdgeToCollapse[i])
+00047 {
+00048 <span class="comment">// the vertex which must be collapsed is v0.</span>
+00049 vertToCollapse= _Lods[lod].EdgeToCollapse[i].v0;
+00050 <span class="keywordflow">return</span> i;
+00051 }
+00052 }
+00053 <span class="comment">// not found</span>
+00054 <span class="keywordflow">return</span> -1;
+00055 }
+</pre></div> </td>
+ </tr>
+</table>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="NL3D_1_1CMRMSewingMeshr0" doxytag="NL3D::CMRMSewingMesh::_Lods" ></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="a02969.html">CLod</a>&gt; <a class="el" href="a02968.html#NL3D_1_1CMRMSewingMeshr0">NL3D::CMRMSewingMesh::_Lods</a><code> [private]</code>
+ </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="a06058.html#l00336">336</a> of file <a class="el" href="a06058.html">mrm_internal.h</a>. </td>
+ </tr>
+</table>
+<hr>The documentation for this class was generated from the following files:<ul>
+<li><a class="el" href="a06058.html">mrm_internal.h</a><li><a class="el" href="a06057.html">mrm_internal.cpp</a></ul>
+<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:57:06 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>