diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a02449.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to 'docs/doxygen/nel/a02449.html')
-rw-r--r-- | docs/doxygen/nel/a02449.html | 1021 |
1 files changed, 1021 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02449.html b/docs/doxygen/nel/a02449.html new file mode 100644 index 00000000..2f9fbfff --- /dev/null +++ b/docs/doxygen/nel/a02449.html @@ -0,0 +1,1021 @@ +<!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: NLPACS::CEdgeCollideNode 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 Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLPACS::CEdgeCollideNode Class Reference</h1><code>#include <<a class="el" href="a05583.html">collision_surface_temp.h</a>></code> +<p> +<p>Inheritance diagram for NLPACS::CEdgeCollideNode: +<p><center><img src="a02449.png" usemap="#NLPACS::CEdgeCollideNode_map" border="0" alt=""></center> +<map name="NLPACS::CEdgeCollideNode_map"> +<area href="a02448.html" alt="NLPACS::CEdgeCollide" shape="rect" coords="0,0,175,24"> +</map> +<hr><a name="_details"></a><h2>Detailed Description</h2> +Temp collision data used during tryMove(). <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2001 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a05583.html#l00045">45</a> of file <a class="el" href="a05583.html">collision_surface_temp.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>enum </td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5">TPointMoveProblem</a> { <br> + <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew1">ParallelEdges</a> = 0, +<a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew3">StartOnEdge</a>, +<a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew4">StopOnEdge</a>, +<a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew6">TraverseEndPoint</a>, +<br> + <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew0">EdgeNull</a>, +<a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew2">PointMoveProblemCount</a> +<br> + }</td></tr> + +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02449.html#NLPACS_1_1CEdgeCollideNodea0">CEdgeCollideNode</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodea1">make</a> (const <a class="el" href="a03660.html">CVector2f</a> &p0, const <a class="el" href="a03660.html">CVector2f</a> &p1)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodea2">testBBoxCollide</a> (const <a class="el" href="a03660.html">CVector2f</a> bbox[4])</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodea3">testBBoxMove</a> (const <a class="el" href="a03660.html">CVector2f</a> &start, const <a class="el" href="a03660.html">CVector2f</a> &delta, const <a class="el" href="a03660.html">CVector2f</a> bbox[4], <a class="el" href="a03660.html">CVector2f</a> &normal)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodea4">testCircleMove</a> (const <a class="el" href="a03660.html">CVector2f</a> &start, const <a class="el" href="a03660.html">CVector2f</a> &delta, float radius, <a class="el" href="a03660.html">CVector2f</a> &normal)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03305.html">CRational64</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodea5">testPointMove</a> (const <a class="el" href="a03660.html">CVector2f</a> &start, const <a class="el" href="a03660.html">CVector2f</a> &end, <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5">TPointMoveProblem</a> &moveBug)</td></tr> + +<tr><td colspan=2><br><h2>Data Fields</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo0">A0</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo1">A1</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo2">C</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03660.html">CVector2f</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo3">Dir</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02449.html#NLPACS_1_1CEdgeCollideNodeo4">Next</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Next edgeCollideNode in the <a class="el" href="a02387.html">CCollisionSurfaceTemp</a> allocator. 0xFFFFFFFF if none. <a href="#NLPACS_1_1CEdgeCollideNodeo4"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03660.html">CVector2f</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03660.html">CVector2f</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03660.html">CVector2f</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a></td></tr> + +</table> +<hr><h2>Member Enumeration Documentation</h2> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodew5" doxytag="NLPACS::CEdgeCollideNode::TPointMoveProblem" ></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"> enum <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5">NLPACS::CEdgeCollide::TPointMoveProblem</a><code> [inherited]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +<dl compact><dt><b>Enumeration values: </b></dt><dd> +<table border=0 cellspacing=2 cellpadding=0> +<tr><td valign=top><em><a class="anchor" name="NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew1" doxytag="ParallelEdges" ></a>ParallelEdges</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew3" doxytag="StartOnEdge" ></a>StartOnEdge</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew4" doxytag="StopOnEdge" ></a>StopOnEdge</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew6" doxytag="TraverseEndPoint" ></a>TraverseEndPoint</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew0" doxytag="EdgeNull" ></a>EdgeNull</em> </td><td> +</td></tr> +<tr><td valign=top><em><a class="anchor" name="NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew2" doxytag="PointMoveProblemCount" ></a>PointMoveProblemCount</em> </td><td> +</td></tr> +</table> +</dl> + +<p> +Definition at line <a class="el" href="a05665.html#l00183">183</a> of file <a class="el" href="a05665.html">edge_collide.h</a>. +<p> +<div class="fragment"><pre>00183 {<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew1">ParallelEdges</a>=0, <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew3">StartOnEdge</a>, <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew4">StopOnEdge</a>, <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew6">TraverseEndPoint</a>, <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew0">EdgeNull</a>, <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew2">PointMoveProblemCount</a>}; +</pre></div> </td> + </tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodea0" doxytag="NLPACS::CEdgeCollideNode::CEdgeCollideNode" ></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"> NLPACS::CEdgeCollideNode::CEdgeCollideNode </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05583.html#l00052">52</a> of file <a class="el" href="a05583.html">collision_surface_temp.h</a>. +<p> +<div class="fragment"><pre>00053 { +00054 <a class="code" href="a02449.html#NLPACS_1_1CEdgeCollideNodeo4">Next</a>= 0xFFFFFFFF; +00055 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodea1" doxytag="NLPACS::CEdgeCollideNode::make" ></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 NLPACS::CEdgeCollide::make </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03660.html">CVector2f</a> & </td> + <td class="mdname" nowrap> <em>p0</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03660.html">CVector2f</a> & </td> + <td class="mdname" nowrap> <em>p1</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [inherited]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05664.html#l00043">43</a> of file <a class="el" href="a05664.html">edge_collide.cpp</a>. +<p> +References <a class="el" href="a05665.html#l00190">NLPACS::CEdgeCollide::A0</a>, <a class="el" href="a05665.html#l00190">NLPACS::CEdgeCollide::A1</a>, <a class="el" href="a05665.html#l00191">NLPACS::CEdgeCollide::C</a>, <a class="el" href="a05665.html#l00189">NLPACS::CEdgeCollide::Norm</a>, <a class="el" href="a06677.html#l00093">NLMISC::CVector2f::normalize()</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="a05929.html#l01807">NLPACS::CLocalRetriever::testCollision()</a>, and <a class="el" href="a06337.html#l00635">NLPACS::CRetrieverInstance::testExteriorCollision()</a>. +<p> +<div class="fragment"><pre>00044 { +00045 <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>= p0; +00046 <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>= p1; +00047 <span class="comment">// translation axis of the edge.</span> +00048 <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo3">Dir</a>= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>-<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>; +00049 <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo3">Dir</a>.normalize(); +00050 <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo0">A0</a>= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo3">Dir</a>; +00051 <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo1">A1</a>= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>*Dir; +00052 <span class="comment">// line equation.</span> +00053 <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a>.x= Dir.y; +00054 <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a>.y= -Dir.x; +00055 <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo2">C</a>= - <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a>; +00056 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodea2" doxytag="NLPACS::CEdgeCollideNode::testBBoxCollide" ></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 NLPACS::CEdgeCollide::testBBoxCollide </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03660.html">CVector2f</a> </td> + <td class="mdname1" valign="top" nowrap> <em>bbox</em>[4] </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inherited]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +return true if this oriented bbox collide this edge. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>bbox</em> </td><td>4 points of the bbox, in CCW. </td></tr> + </table> +</dl> +<dl compact><dt><b>Returns:</b></dt><dd>true if collision occurs.</dd></dl> + +<p> +Definition at line <a class="el" href="a05664.html#l00657">657</a> of file <a class="el" href="a05664.html">edge_collide.cpp</a>. +<p> +References <a class="el" href="a05981.html#l00104">sint</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="a05761.html#l02303">NLPACS::CGlobalRetriever::testRotCollisionWithCollisionChains()</a>. +<p> +<div class="fragment"><pre>00658 { +00659 <span class="comment">// clip the edge against the edge of the bbox.</span> +00660 CVector2f p0= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>, p1= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>; +00661 +00662 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0; i<4; i++) +00663 { +00664 CVector2f a= bbox[i]; +00665 CVector2f b= bbox[(i+1)&3]; +00666 CVector2f delta= b-a, norm; +00667 <span class="comment">// sign is important. bbox is CCW. normal goes OUT the bbox.</span> +00668 norm.x= delta.y; +00669 norm.y= -delta.x; +00670 +00671 <span class="keywordtype">float</span> d0= (p0-a)*norm; +00672 <span class="keywordtype">float</span> d1= (p1-a)*norm; +00673 +00674 <span class="comment">// if boths points are out this plane, no collision.</span> +00675 <span class="keywordflow">if</span>( d0>0 && d1>0) +00676 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00677 <span class="comment">// if difference, must clip.</span> +00678 <span class="keywordflow">if</span>( d0>0 || d1>0) +00679 { +00680 CVector2f intersect= p0 + (p1-p0)* ((0-d0)/(d1-d0)); +00681 <span class="keywordflow">if</span>(d1>0) +00682 p1= intersect; +00683 <span class="keywordflow">else</span> +00684 p0= intersect; +00685 } +00686 } +00687 +00688 <span class="comment">// if a segment is still in the bbox, collision occurs.</span> +00689 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00690 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodea3" doxytag="NLPACS::CEdgeCollideNode::testBBoxMove" ></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 NLPACS::CEdgeCollide::testBBoxMove </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03660.html">CVector2f</a> & </td> + <td class="mdname" nowrap> <em>start</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03660.html">CVector2f</a> & </td> + <td class="mdname" nowrap> <em>delta</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03660.html">CVector2f</a> </td> + <td class="mdname" nowrap> <em>bbox</em>[4], </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03660.html">CVector2f</a> & </td> + <td class="mdname" nowrap> <em>normal</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [inherited]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +return 1 either if the bbox moves away from the line, or no collision occurs. Else return a [0,1[ interval. If collision occurs (ie return<1), return in "normal" the normal of the collision. It may be normal of edge (+-), or normal against a point of the edge. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>bbox</em> </td><td>4 points of the bbox at start. start must be the barycentre of those points.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a05664.html#l00559">559</a> of file <a class="el" href="a05664.html">edge_collide.cpp</a>. +<p> +References <a class="el" href="a05665.html#l00191">NLPACS::CEdgeCollide::C</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05665.html#l00189">NLPACS::CEdgeCollide::Norm</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05664.html#l00394">NLPACS::CEdgeCollide::testEdgeMove()</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="a05761.html#l01392">NLPACS::CGlobalRetriever::testCollisionWithCollisionChains()</a>. +<p> +<div class="fragment"><pre>00560 { +00561 <span class="comment">// distance from center to line.</span> +00562 <span class="keywordtype">float</span> dist= start*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a> + <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo2">C</a>; +00563 +00564 <span class="comment">// test if the movement is against the line or not.</span> +00565 <span class="keywordtype">bool</span> sensPos= dist>0; +00566 <span class="comment">// if signs are equals, same side of the line, so we allow the circle to leave the line.</span> +00567 <span class="comment">/*if(sensPos==sensSpeed)</span> +00568 <span class="comment"> return 1;*/</span> +00569 +00570 +00571 <span class="comment">// Else, do 4 test edge/edge, and return Tmin.</span> +00572 <span class="keywordtype">float</span> tMin, tMax; +00573 <span class="keywordtype">bool</span> edgeCollided= <span class="keyword">false</span>; +00574 <span class="keywordtype">bool</span> normalOnBox= <span class="keyword">false</span>; +00575 CVector2f boxNormal; +00576 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0;i<4;i++) +00577 { +00578 <span class="keywordtype">float</span> t0, t1; +00579 <span class="keywordtype">bool</span> nob; +00580 CVector2f a= bbox[i]; +00581 CVector2f b= bbox[(i+1)&3]; +00582 +00583 <span class="comment">// test move against this edge.</span> +00584 <span class="keywordflow">if</span>(<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollided0">testEdgeMove</a>(a, b, delta, t0, t1, nob)) +00585 { +00586 <span class="keywordflow">if</span>(edgeCollided) +00587 { +00588 tMin= <a class="code" href="a04061.html#a0">min</a>(t0, tMin); +00589 tMax= max(t1, tMax); +00590 } +00591 <span class="keywordflow">else</span> +00592 { +00593 edgeCollided= <span class="keyword">true</span>; +00594 tMin= t0; +00595 tMax= t1; +00596 } +00597 +00598 <span class="comment">// get normal of box against we collide.</span> +00599 <span class="keywordflow">if</span>(tMin==t0) +00600 { +00601 normalOnBox= nob; +00602 <span class="keywordflow">if</span>(nob) +00603 { +00604 CVector2f dab; +00605 <span class="comment">// bbox must be CCW.</span> +00606 dab= b-a; +00607 <span class="comment">// the normal is computed so that the vector goes In the bbox.</span> +00608 boxNormal.x= -dab.y; +00609 boxNormal.y= dab.x; +00610 } +00611 } +00612 } +00613 } +00614 +00615 <span class="comment">// if collision occurs,and int the [0,1] interval...</span> +00616 <span class="keywordflow">if</span>(edgeCollided && tMin<1 && tMax>0) +00617 { +00618 <span class="comment">// compute normal of collision.</span> +00619 <span class="keywordflow">if</span>(normalOnBox) +00620 { +00621 <span class="comment">// assume collsion is an endpoint of the edge against the bbox.</span> +00622 normal= boxNormal; +00623 } +00624 <span class="keywordflow">else</span> +00625 { +00626 <span class="comment">// assume collision occurs on interior of the edge. the normal to return is +- Norm.</span> +00627 <span class="keywordflow">if</span>(sensPos) <span class="comment">// if algebric distance of start position was >0.</span> +00628 normal= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a>; +00629 <span class="keywordflow">else</span> +00630 normal= -Norm; +00631 } +00632 +00633 <span class="comment">// compute time of collison.</span> +00634 <span class="keywordflow">if</span>(tMin>0) +00635 <span class="comment">// return time of collision.</span> +00636 <span class="keywordflow">return</span> tMin; +00637 <span class="keywordflow">else</span> +00638 { +00639 <span class="comment">// The bbox is inside the edge, at t==0. test if it goes out or not.</span> +00640 <span class="comment">// accept only if we are much near the exit than the enter.</span> +00641 <span class="comment">/* NB: 0.2 is an empirical value "which works well". Normally, 1 is the good value, but because of the</span> +00642 <span class="comment"> "SURFACEMOVE NOT DETECTED" Problem (see testCircleMove()), we must be more restrictive.</span> +00643 <span class="comment"> */</span> +00644 <span class="keywordflow">if</span>( tMax<0.2*(-tMin) ) +00645 <span class="keywordflow">return</span> 1; +00646 <span class="keywordflow">else</span> +00647 <span class="keywordflow">return</span> 0; +00648 } +00649 } +00650 <span class="keywordflow">else</span> +00651 <span class="keywordflow">return</span> 1; +00652 +00653 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodea4" doxytag="NLPACS::CEdgeCollideNode::testCircleMove" ></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 NLPACS::CEdgeCollide::testCircleMove </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03660.html">CVector2f</a> & </td> + <td class="mdname" nowrap> <em>start</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03660.html">CVector2f</a> & </td> + <td class="mdname" nowrap> <em>delta</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>radius</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03660.html">CVector2f</a> & </td> + <td class="mdname" nowrap> <em>normal</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [inherited]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +return 1 either if the circle moves away from the line, or no collision occurs. Else return a [0,1[ interval. If collision occurs (ie return<1), return in "normal" the normal of the collision. It may be normal of edge (+-), or normal against a point of the edge. +<p> +Definition at line <a class="el" href="a05664.html#l00265">265</a> of file <a class="el" href="a05664.html">edge_collide.cpp</a>. +<p> +References <a class="el" href="a05665.html#l00190">NLPACS::CEdgeCollide::A0</a>, <a class="el" href="a05665.html#l00190">NLPACS::CEdgeCollide::A1</a>, <a class="el" href="a05665.html#l00191">NLPACS::CEdgeCollide::C</a>, <a class="el" href="a06677.html#l00113">NLMISC::CVector2f::isNull()</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05665.html#l00189">NLPACS::CEdgeCollide::Norm</a>, <a class="el" href="a06677.html#l00093">NLMISC::CVector2f::normalize()</a>, <a class="el" href="a05646.html#l00985">t</a>, and <a class="el" href="a05664.html#l00194">NLPACS::testCirclePoint()</a>. +<p> +Referenced by <a class="el" href="a05761.html#l01392">NLPACS::CGlobalRetriever::testCollisionWithCollisionChains()</a>. +<p> +<div class="fragment"><pre>00266 { +00267 <span class="comment">// If the movement is NULL, return 1 (no collision!)</span> +00268 <span class="keywordflow">if</span>( delta.isNull() ) +00269 <span class="keywordflow">return</span> 1; +00270 +00271 <span class="comment">// distance from point to line.</span> +00272 <span class="keywordtype">double</span> dist= start*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a> + <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo2">C</a>; +00273 <span class="comment">// projection of speed on normal.</span> +00274 <span class="keywordtype">double</span> speed= delta*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a>; +00275 +00276 <span class="comment">// test if the movement is against the line or not.</span> +00277 <span class="keywordtype">bool</span> sensPos= dist>0; +00278 <span class="keywordtype">bool</span> sensSpeed= speed>0; +00279 +00280 <span class="comment">// Does the point intersect the line?</span> +00281 dist= fabs(dist) - radius; +00282 speed= fabs(speed); +00283 <span class="keywordflow">if</span>( dist > speed ) +00284 <span class="keywordflow">return</span> 1; +00285 +00286 <span class="comment">// if not already in collision with the line, test when it collides.</span> +00287 <span class="comment">// ===============================</span> +00288 <span class="keywordflow">if</span>(dist>=0) +00289 { +00290 <span class="comment">// if signs are equals, same side of the line, so we allow the circle to leave the line.</span> +00291 <span class="keywordflow">if</span>(sensPos==sensSpeed ) +00292 <span class="keywordflow">return</span> 1; +00293 +00294 <span class="comment">// if speed is 0, it means that movement is parralel to the line => never collide.</span> +00295 <span class="keywordflow">if</span>(speed==0) +00296 <span class="keywordflow">return</span> 1; +00297 +00298 <span class="comment">// collide the line, at what time.</span> +00299 <span class="keywordtype">double</span> <a class="code" href="a04223.html#a627">t</a>= dist/speed; +00300 +00301 +00302 <span class="comment">// compute the collision position of the Circle on the edge.</span> +00303 <span class="comment">// this gives the center of the sphere at the collision point.</span> +00304 <a class="code" href="a03659.html">CVector2d</a> proj= <a class="code" href="a03659.html">CVector2d</a>(start) + CVector2d(delta)*<a class="code" href="a04223.html#a627">t</a>; +00305 <span class="comment">// must add radius vector.</span> +00306 proj+= Norm * (sensSpeed?radius:-radius); +00307 <span class="comment">// compute projection on edge.</span> +00308 <span class="keywordtype">double</span> aProj= proj*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo3">Dir</a>; +00309 +00310 <span class="comment">// if on the interval of the edge.</span> +00311 <span class="keywordflow">if</span>( aProj>=<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo0">A0</a> && aProj<=<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo1">A1</a>) +00312 { +00313 <span class="comment">// collision occurs on interior of the edge. the normal to return is +- Norm.</span> +00314 <span class="keywordflow">if</span>(sensPos) <span class="comment">// if algebric distance of start position was >0.</span> +00315 normal= Norm; +00316 <span class="keywordflow">else</span> +00317 normal= -Norm; +00318 +00319 <span class="comment">// return time of collision.</span> +00320 <span class="keywordflow">return</span> (<span class="keywordtype">float</span>)<a class="code" href="a04223.html#a627">t</a>; +00321 } +00322 } +00323 <span class="comment">// else, must test if circle collide segment at t=0. if yes, return 0.</span> +00324 <span class="comment">// ===============================</span> +00325 <span class="keywordflow">else</span> +00326 { +00327 <span class="comment">// There is just need to test if projection of circle's center onto the line hit the segment.</span> +00328 <span class="comment">// This is not a good test to know if a circle intersect a segment, but other cases are</span> +00329 <span class="comment">// managed with test of endPoints of the segment after.</span> +00330 <span class="keywordtype">float</span> aProj= start*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo3">Dir</a>; +00331 +00332 <span class="comment">// if on the interval of the edge.</span> +00333 <span class="keywordflow">if</span>( aProj>=<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo0">A0</a> && aProj<=<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo1">A1</a>) +00334 { +00335 <span class="comment">// if signs are equals, same side of the line, so we allow the circle to leave the edge.</span> +00336 <span class="comment">/* Special case: do not allow to leave the edge if we are too much in the edge.</span> +00337 <span class="comment"> It is important for CGlobalRetriever::testCollisionWithCollisionChains() because of the</span> +00338 <span class="comment"> "SURFACEMOVE NOT DETECTED" Problem.</span> +00339 <span class="comment"> Suppose we can walk on this chain SA/SB (separate Surface A/SurfaceB). Suppose we are near this edge, </span> +00340 <span class="comment"> and on Surface SA, and suppose there is an other chain SB/SC the circle collide with. If we </span> +00341 <span class="comment"> return 1 (no collision), SB/SC won't be detected (because only SA/?? chains will be tested) and </span> +00342 <span class="comment"> so the cylinder will penetrate SB/SC...</span> +00343 <span class="comment"> This case arise at best if chains SA/SB and chain SB/SC do an angle of 45deg</span> +00344 <span class="comment"></span> +00345 <span class="comment"> \todo yoyo: this is a Hack.</span> +00346 <span class="comment"> */</span> +00347 <span class="keywordflow">if</span>(sensPos==sensSpeed && (-dist)<0.5*radius) +00348 { +00349 <span class="keywordflow">return</span> 1; +00350 } +00351 <span class="keywordflow">else</span> +00352 { +00353 <span class="comment">// hit the interior of the edge, and sensPos!=sensSpeed. So must stop now!!</span> +00354 <span class="comment">// collision occurs on interior of the edge. the normal to return is +- Norm.</span> +00355 <span class="keywordflow">if</span>(sensPos) <span class="comment">// if algebric distance of start position was >0.</span> +00356 normal= Norm; +00357 <span class="keywordflow">else</span> +00358 normal= -Norm; +00359 +00360 <span class="keywordflow">return</span> 0; +00361 } +00362 } +00363 } +00364 +00365 <span class="comment">// In this case, the Circle do not hit the edge on the interior, but may hit on borders.</span> +00366 <span class="comment">// ===============================</span> +00367 <span class="comment">// Then, we must compute collision sphere-points.</span> +00368 <span class="keywordtype">float</span> tmin, ttmp; +00369 <span class="comment">// first point.</span> +00370 tmin= <a class="code" href="a05380.html#a27">testCirclePoint</a>(start, delta, radius, P0); +00371 <span class="comment">// second point.</span> +00372 ttmp= <a class="code" href="a05380.html#a27">testCirclePoint</a>(start, delta, radius, P1); +00373 tmin= <a class="code" href="a04061.html#a0">min</a>(tmin, ttmp); +00374 +00375 <span class="comment">// if collision occurs, compute normal of collision.</span> +00376 <span class="keywordflow">if</span>(tmin<1) +00377 { +00378 <span class="comment">// to which point we collide?</span> +00379 CVector2f colPoint= tmin==ttmp? <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a> : <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>; +00380 <span class="comment">// compute position of the entity at collision.</span> +00381 CVector2f colPos= start + delta*tmin; +00382 +00383 <span class="comment">// and so we have this normal (the perpendicular of the tangent at this point).</span> +00384 normal= colPos - colPoint; +00385 normal.normalize(); +00386 } +00387 +00388 <span class="keywordflow">return</span> tmin; +00389 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodea5" doxytag="NLPACS::CEdgeCollideNode::testPointMove" ></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="a03305.html">CRational64</a> NLPACS::CEdgeCollide::testPointMove </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03660.html">CVector2f</a> & </td> + <td class="mdname" nowrap> <em>start</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03660.html">CVector2f</a> & </td> + <td class="mdname" nowrap> <em>end</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5">TPointMoveProblem</a> & </td> + <td class="mdname" nowrap> <em>moveBug</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [inherited]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +return 1 either if no collision occurs. Else return a [0,1[ interval. return -1 if precision problem (see below). This method is used by <a class="el" href="a02588.html#NLPACS_1_1CGlobalRetrieverz1245_0">CGlobalRetriever::doMove()</a>. UnManageables cases arise when:<ul> +<li>the movement start/stop on a edge (dist==0). In this case, don't know on what surface we arrive (before or after).</li><li>the movement is // to the edge and collide with it. same problem than stop on an edge.</li><li>the movement traverse the edge on an endpoint. In this case, there is 2+ edges sharing the point, and result is undefined. On thoses cases, moveBug is filled, and -1 is returned.</li></ul> + +<p> +Definition at line <a class="el" href="a05664.html#l00060">60</a> of file <a class="el" href="a05664.html">edge_collide.cpp</a>. +<p> +References <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew0">NLPACS::CEdgeCollide::EdgeNull</a>, <a class="el" href="a05587.html#l00094">NLMISC::fsgn()</a>, <a class="el" href="a05981.html#l00107">NL_I64</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew1">NLPACS::CEdgeCollide::ParallelEdges</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00101">sint64</a>, <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew3">NLPACS::CEdgeCollide::StartOnEdge</a>, <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew4">NLPACS::CEdgeCollide::StopOnEdge</a>, <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew6">NLPACS::CEdgeCollide::TraverseEndPoint</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="a05761.html#l01649">NLPACS::CGlobalRetriever::testMovementWithCollisionChains()</a>. +<p> +<div class="fragment"><pre>00061 { +00062 <span class="comment">/*</span> +00063 <span class="comment"> To have a correct test (with no float precision problem):</span> +00064 <span class="comment"> - test first if there is collision beetween the 2 edges:</span> +00065 <span class="comment"> - test if first edge collide the other line.</span> +00066 <span class="comment"> - test if second edge collide the other line.</span> +00067 <span class="comment"> - if both true, yes, there is a collision.</span> +00068 <span class="comment"> - compute time of collision.</span> +00069 <span class="comment"> */</span> +00070 +00071 +00072 <span class="comment">// *this must be a correct edge.</span> +00073 <span class="keywordflow">if</span>(<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>==<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>) +00074 { +00075 moveBug= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew0">EdgeNull</a>; +00076 <span class="keywordflow">return</span> -1; +00077 } +00078 +00079 <span class="comment">// if no movement, no collision.</span> +00080 <span class="keywordflow">if</span>(start==end) +00081 <span class="keywordflow">return</span> 1; +00082 +00083 <span class="comment">// NB those edges are snapped (1/256 for edgeCollide, and 1/1024 for start/end), so no float problem here.</span> +00084 <span class="comment">// precision is 20 bits.</span> +00085 CVector2f normEdge; +00086 CVector2f normMove; +00087 CVector2f deltaEdge; +00088 CVector2f deltaMove; +00089 +00090 <span class="comment">// compute normal of the edge (not normalized, because no need, and for precision problem).</span> +00091 deltaEdge= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>-<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>; +00092 normEdge.x= -deltaEdge.y; +00093 normEdge.y= deltaEdge.x; +00094 +00095 <span class="comment">// compute normal of the movement (not normalized, because no need, and for precision problem).</span> +00096 deltaMove= end-start; +00097 normMove.x= -deltaMove.y; +00098 normMove.y= deltaMove.x; +00099 +00100 <span class="comment">// distance from points of movment against edge line. Use double, because of multiplication.</span> +00101 <span class="comment">// precision is now 43 bits.</span> +00102 <span class="keywordtype">double</span> moveD0= (<span class="keywordtype">double</span>)normEdge.x*(<span class="keywordtype">double</span>)(start.x-<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.x) + (<span class="keywordtype">double</span>)normEdge.y*(<span class="keywordtype">double</span>)(start.y-<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.y); +00103 <span class="keywordtype">double</span> moveD1= (<span class="keywordtype">double</span>)normEdge.x*(<span class="keywordtype">double</span>)(end.x -<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.x) + (<span class="keywordtype">double</span>)normEdge.y*(<span class="keywordtype">double</span>)(end.y -<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.y); +00104 +00105 <span class="comment">// distance from points of edge against movement line. Use double, because of multiplication.</span> +00106 <span class="comment">// precision is now 43 bits.</span> +00107 <span class="keywordtype">double</span> edgeD0= (<span class="keywordtype">double</span>)normMove.x*(<span class="keywordtype">double</span>)(<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.x-start.x) + (<span class="keywordtype">double</span>)normMove.y*(<span class="keywordtype">double</span>)(<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.y-start.y); +00108 <span class="keywordtype">double</span> edgeD1= (<span class="keywordtype">double</span>)normMove.x*(<span class="keywordtype">double</span>)(<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>.x-start.x) + (<span class="keywordtype">double</span>)normMove.y*(<span class="keywordtype">double</span>)(<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>.y-start.y); +00109 +00110 +00111 <span class="comment">// If both edges intersect lines (including endpoints), there is a collision, else none.</span> +00112 <a class="code" href="a04558.html#a14">sint</a> sgnMove0, sgnMove1; +00113 sgnMove0= <a class="code" href="a05378.html#a372">fsgn</a>(moveD0); +00114 sgnMove1= <a class="code" href="a05378.html#a372">fsgn</a>(moveD1); +00115 +00116 <span class="comment">// special case if the 2 edges lies on the same line.</span> +00117 <span class="keywordflow">if</span>(sgnMove0==0 && sgnMove1==0) +00118 { +00119 <span class="comment">// must test if there is a collision. if yes, problem.</span> +00120 <span class="comment">// project all the points on the line of the edge.</span> +00121 <span class="comment">// Use double because of multiplication. precision is now 43 bits.</span> +00122 <span class="keywordtype">double</span> moveA0= (<span class="keywordtype">double</span>)deltaEdge.x*(<span class="keywordtype">double</span>)(start.x-<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.x) + (<span class="keywordtype">double</span>)deltaEdge.y*(<span class="keywordtype">double</span>)(start.y-<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.y); +00123 <span class="keywordtype">double</span> moveA1= (<span class="keywordtype">double</span>)deltaEdge.x*(<span class="keywordtype">double</span>)(end.x -<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.x) + (<span class="keywordtype">double</span>)deltaEdge.y*(<span class="keywordtype">double</span>)(end.y -<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.y); +00124 <span class="keywordtype">double</span> edgeA0= 0; +00125 <span class="keywordtype">double</span> edgeA1= (<span class="keywordtype">double</span>)deltaEdge.x*(<span class="keywordtype">double</span>)deltaEdge.x + (<span class="keywordtype">double</span>)deltaEdge.y*(<span class="keywordtype">double</span>)deltaEdge.y; +00126 +00127 <span class="comment">// Test is there is intersection (endpoints included). if yes, return -1. else return 1 (no collision at all).</span> +00128 <span class="keywordflow">if</span>(moveA1>=edgeA0 && edgeA1>=moveA0) +00129 { +00130 moveBug= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew1">ParallelEdges</a>; +00131 <span class="keywordflow">return</span> -1; +00132 } +00133 <span class="keywordflow">else</span> +00134 <span class="keywordflow">return</span> 1; +00135 } +00136 +00137 <span class="comment">// if on same side of the line=> there is no collision.</span> +00138 <span class="keywordflow">if</span>( sgnMove0==sgnMove1) +00139 <span class="keywordflow">return</span> 1; +00140 +00141 <span class="comment">// test edge against move line.</span> +00142 <a class="code" href="a04558.html#a14">sint</a> sgnEdge0, sgnEdge1; +00143 sgnEdge0= <a class="code" href="a05378.html#a372">fsgn</a>(edgeD0); +00144 sgnEdge1= <a class="code" href="a05378.html#a372">fsgn</a>(edgeD1); +00145 +00146 <span class="comment">// should not have this case, because tested before with (sgnMove==0 && sgnMove1==0).</span> +00147 <a class="code" href="a04199.html#a6">nlassert</a>(sgnEdge0!=0 || sgnEdge1!=0); +00148 +00149 +00150 <span class="comment">// if on same side of the line, no collision against this edge.</span> +00151 <span class="keywordflow">if</span>( sgnEdge0==sgnEdge1 ) +00152 <span class="keywordflow">return</span> 1; +00153 +00154 <span class="comment">// Here the edges intersect, but ensure that there is no limit problem.</span> +00155 <span class="keywordflow">if</span>(sgnEdge0==0 || sgnEdge1==0) +00156 { +00157 moveBug= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew6">TraverseEndPoint</a>; +00158 <span class="keywordflow">return</span> -1; +00159 } +00160 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(sgnMove1==0) +00161 { +00162 moveBug= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew4">StopOnEdge</a>; +00163 <span class="keywordflow">return</span> -1; +00164 } +00165 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(sgnMove0==0) +00166 { +00167 <span class="comment">// this should not arrive.</span> +00168 moveBug= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew3">StartOnEdge</a>; +00169 <span class="keywordflow">return</span> -1; +00170 } +00171 +00172 +00173 <span class="comment">// Here, there is a normal collision, just compute it.</span> +00174 <span class="comment">// Because of Division, there is a precision lost in double. So compute a CRational64.</span> +00175 <span class="comment">// First, compute numerator and denominator in the highest precision. this is 1024*1024 because of prec multiplication.</span> +00176 <span class="keywordtype">double</span> numerator= (0-moveD0)*1024*1024; +00177 <span class="keywordtype">double</span> denominator= (moveD1-moveD0)*1024*1024; +00178 <a class="code" href="a04558.html#a12">sint64</a> numeratorInt= (<a class="code" href="a04558.html#a12">sint64</a>)numerator; +00179 <a class="code" href="a04558.html#a12">sint64</a> denominatorInt= (<a class="code" href="a04558.html#a12">sint64</a>)denominator; +00180 <span class="comment">/*</span> +00181 <span class="comment"> nlassert(numerator == numeratorInt);</span> +00182 <span class="comment"> nlassert(denominator == denominatorInt);</span> +00183 <span class="comment">*/</span> +00184 <span class="keywordflow">if</span> (numerator != numeratorInt) +00185 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"numerator(%f) != numeratorInt(%"</span>NL_I64<span class="stringliteral">"d)"</span>, numerator, numeratorInt); +00186 <span class="keywordflow">if</span> (denominator != denominatorInt) +00187 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"denominator(%f) != denominatorInt(%"</span>NL_I64<span class="stringliteral">"d)"</span>, denominator, denominatorInt); +00188 +00189 <span class="keywordflow">return</span> CRational64(numeratorInt, denominatorInt); +00190 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo0" doxytag="NLPACS::CEdgeCollideNode::A0" ></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 <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo0">NLPACS::CEdgeCollide::A0</a><code> [inherited]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05665.html#l00190">190</a> of file <a class="el" href="a05665.html">edge_collide.h</a>. +<p> +Referenced by <a class="el" href="a05664.html#l00043">NLPACS::CEdgeCollide::make()</a>, and <a class="el" href="a05664.html#l00265">NLPACS::CEdgeCollide::testCircleMove()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo1" doxytag="NLPACS::CEdgeCollideNode::A1" ></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 <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo1">NLPACS::CEdgeCollide::A1</a><code> [inherited]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05665.html#l00190">190</a> of file <a class="el" href="a05665.html">edge_collide.h</a>. +<p> +Referenced by <a class="el" href="a05664.html#l00043">NLPACS::CEdgeCollide::make()</a>, and <a class="el" href="a05664.html#l00265">NLPACS::CEdgeCollide::testCircleMove()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo2" doxytag="NLPACS::CEdgeCollideNode::C" ></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 <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo2">NLPACS::CEdgeCollide::C</a><code> [inherited]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05665.html#l00191">191</a> of file <a class="el" href="a05665.html">edge_collide.h</a>. +<p> +Referenced by <a class="el" href="a05664.html#l00043">NLPACS::CEdgeCollide::make()</a>, <a class="el" href="a05664.html#l00559">NLPACS::CEdgeCollide::testBBoxMove()</a>, and <a class="el" href="a05664.html#l00265">NLPACS::CEdgeCollide::testCircleMove()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo3" doxytag="NLPACS::CEdgeCollideNode::Dir" ></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="a03660.html">CVector2f</a> <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo3">NLPACS::CEdgeCollide::Dir</a><code> [inherited]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05665.html#l00189">189</a> of file <a class="el" href="a05665.html">edge_collide.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo4" doxytag="NLPACS::CEdgeCollideNode::Next" ></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#a11">uint32</a> <a class="el" href="a02449.html#NLPACS_1_1CEdgeCollideNodeo4">NLPACS::CEdgeCollideNode::Next</a> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Next edgeCollideNode in the <a class="el" href="a02387.html">CCollisionSurfaceTemp</a> allocator. 0xFFFFFFFF if none. +<p> + +<p> +Definition at line <a class="el" href="a05583.html#l00049">49</a> of file <a class="el" href="a05583.html">collision_surface_temp.h</a>. +<p> +Referenced by <a class="el" href="a05929.html#l01807">NLPACS::CLocalRetriever::testCollision()</a>, <a class="el" href="a05761.html#l01392">NLPACS::CGlobalRetriever::testCollisionWithCollisionChains()</a>, <a class="el" href="a06337.html#l00635">NLPACS::CRetrieverInstance::testExteriorCollision()</a>, <a class="el" href="a05761.html#l01649">NLPACS::CGlobalRetriever::testMovementWithCollisionChains()</a>, and <a class="el" href="a05761.html#l02303">NLPACS::CGlobalRetriever::testRotCollisionWithCollisionChains()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo5" doxytag="NLPACS::CEdgeCollideNode::Norm" ></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="a03660.html">CVector2f</a> <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">NLPACS::CEdgeCollide::Norm</a><code> [inherited]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05665.html#l00189">189</a> of file <a class="el" href="a05665.html">edge_collide.h</a>. +<p> +Referenced by <a class="el" href="a05664.html#l00043">NLPACS::CEdgeCollide::make()</a>, <a class="el" href="a05664.html#l00559">NLPACS::CEdgeCollide::testBBoxMove()</a>, <a class="el" href="a05664.html#l00265">NLPACS::CEdgeCollide::testCircleMove()</a>, and <a class="el" href="a05761.html#l01649">NLPACS::CGlobalRetriever::testMovementWithCollisionChains()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo6" doxytag="NLPACS::CEdgeCollideNode::P0" ></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="a03660.html">CVector2f</a> <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">NLPACS::CEdgeCollide::P0</a><code> [inherited]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05665.html#l00187">187</a> of file <a class="el" href="a05665.html">edge_collide.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo7" doxytag="NLPACS::CEdgeCollideNode::P1" ></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="a03660.html">CVector2f</a> <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">NLPACS::CEdgeCollide::P1</a><code> [inherited]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05665.html#l00188">188</a> of file <a class="el" href="a05665.html">edge_collide.h</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following file:<ul> +<li><a class="el" href="a05583.html">collision_surface_temp.h</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 14:12:32 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> |