<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Crystal Space 1.2.1: csgeom/math3d.h Source File (Crystal Space 1.2.1 Public API Reference)</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="head"> <tr height="59"> <td class="head" width="202" valign="bottom" style="padding-left:0;"><a href="http://www.crystalspace3d.org/"><img src="csblur.png" width="236" height="59" alt="CrystalSpace" border="0"></a></td> <td class="head"><h2>Public API Reference</h2></td> </tr> <tr height="11"> <td colspan="2" class="headshadow" valign="top" style="padding-left:0;"><img src="csblurb.png" width="236" height="11" alt="" border="0"></td> </tr> </table> <div class="content"> <!-- Generated by Doxygen 1.5.3 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul> </div> <h1>csgeom/math3d.h</h1><a href="math3d_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> Copyright (C) 1998-2005 by Jorrit Tyberghein</span> <a name="l00003"></a>00003 <span class="comment"> Largely rewritten by Ivan Avramovic <ivan@avramovic.com></span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment"> This library is free software; you can redistribute it and/or</span> <a name="l00006"></a>00006 <span class="comment"> modify it under the terms of the GNU Library General Public</span> <a name="l00007"></a>00007 <span class="comment"> License as published by the Free Software Foundation; either</span> <a name="l00008"></a>00008 <span class="comment"> version 2 of the License, or (at your option) any later version.</span> <a name="l00009"></a>00009 <span class="comment"></span> <a name="l00010"></a>00010 <span class="comment"> This library is distributed in the hope that it will be useful,</span> <a name="l00011"></a>00011 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00012"></a>00012 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00013"></a>00013 <span class="comment"> Library General Public License for more details.</span> <a name="l00014"></a>00014 <span class="comment"></span> <a name="l00015"></a>00015 <span class="comment"> You should have received a copy of the GNU Library General Public</span> <a name="l00016"></a>00016 <span class="comment"> License along with this library; if not, write to the Free</span> <a name="l00017"></a>00017 <span class="comment"> Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span> <a name="l00018"></a>00018 <span class="comment">*/</span> <a name="l00019"></a>00019 <a name="l00020"></a>00020 <span class="preprocessor">#ifndef __CS_MATH3D_H__</span> <a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define __CS_MATH3D_H__</span> <a name="l00022"></a>00022 <span class="preprocessor"></span> <a name="l00030"></a>00030 <span class="preprocessor">#include "csextern.h"</span> <a name="l00031"></a>00031 <a name="l00032"></a>00032 <span class="preprocessor">#include "<a class="code" href="box_8h.html" title="Bounding boxes for 2D and 3D space.">csgeom/box.h</a>"</span> <a name="l00033"></a>00033 <span class="preprocessor">#include "<a class="code" href="frustum_8h.html" title="General frustum.">csgeom/frustum.h</a>"</span> <a name="l00034"></a>00034 <span class="preprocessor">#include "<a class="code" href="plane3_8h.html" title="3D space plane.">csgeom/plane3.h</a>"</span> <a name="l00035"></a>00035 <span class="preprocessor">#include "<a class="code" href="segment_8h.html" title="2D line segment.">csgeom/segment.h</a>"</span> <a name="l00036"></a>00036 <span class="preprocessor">#include "<a class="code" href="vector3_8h.html" title="3D vector.">csgeom/vector3.h</a>"</span> <a name="l00037"></a>00037 <span class="preprocessor">#include "<a class="code" href="ref_8h.html" title="Smart Pointers.">csutil/ref.h</a>"</span> <a name="l00038"></a>00038 <span class="preprocessor">#include "<a class="code" href="scf__implementation_8h.html" title="Crystal Space Shared Class Facility (SCF) - implementation creation support.">csutil/scf_implementation.h</a>"</span> <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="preprocessor">#include "<a class="code" href="dbghelp_8h.html" title="Debugging helper interface.">iutil/dbghelp.h</a>"</span> <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="keyword">struct </span><a class="code" href="structiString.html" title="This is a SCF-compatible interface for csString.">iString</a>; <a name="l00043"></a>00043 <span class="keyword">class </span><a class="code" href="classcsPlane2.html" title="A plane in 2D space.">csPlane2</a>; <a name="l00044"></a>00044 <span class="keyword">class </span><a class="code" href="classcsPoly3D.html" title="The following class represents a general 3D polygon.">csPoly3D</a>; <a name="l00045"></a>00045 <a name="l00050"></a><a class="code" href="classcsMath3.html">00050</a> <span class="keyword">class </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsMath3.html" title="Various assorted 3D mathematical functions.">csMath3</a> <a name="l00051"></a>00051 { <a name="l00052"></a>00052 <span class="keyword">public</span>: <a name="l00065"></a><a class="code" href="classcsMath3.html#9e66e483d4d32f1d1d452b02952b51ef">00065</a> <span class="keyword">static</span> <span class="keywordtype">int</span> WhichSide3D (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& p, <a name="l00066"></a>00066 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v1, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v2) <a name="l00067"></a>00067 { <a name="l00068"></a>00068 <span class="comment">// float s = p * (v1%v2); (original expression: expanded to the below:)</span> <a name="l00069"></a>00069 <span class="keywordtype">float</span> s = p.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a>*(v1.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a>*v2.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a>-v1.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a>*v2.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a>) + p.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a>*(v1.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a>*v2.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a>-v1.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a>*v2.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a>) + <a name="l00070"></a>00070 p.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a>*(v1.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a>*v2.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a>-v1.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a>*v2.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a>); <a name="l00071"></a>00071 <span class="keywordflow">if</span> (s < 0) <span class="keywordflow">return</span> 1; <a name="l00072"></a>00072 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (s > 0) <span class="keywordflow">return</span> -1; <a name="l00073"></a>00073 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0; <a name="l00074"></a>00074 } <a name="l00075"></a>00075 <a name="l00081"></a>00081 <span class="keyword">static</span> <span class="keywordtype">bool</span> Visible (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& p, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& t1, <a name="l00082"></a>00082 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& t2, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& t3); <a name="l00083"></a>00083 <a name="l00089"></a><a class="code" href="classcsMath3.html#36f2ab62398a34d2ae31f976a62160f6">00089</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> Visible (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& p, <span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& pl) <a name="l00090"></a>00090 { <span class="keywordflow">return</span> pl.<a class="code" href="classcsPlane3.html#4fc26da8112f45f27271c6faf244ab65" title="Classify the given vector with regards to this plane.">Classify</a> (p) <= 0; } <a name="l00091"></a>00091 <a name="l00101"></a>00101 <span class="keyword">static</span> <span class="keywordtype">void</span> Between (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v1, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v2, <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v, <a name="l00102"></a>00102 <span class="keywordtype">float</span> pct, <span class="keywordtype">float</span> wid); <a name="l00103"></a>00103 <a name="l00110"></a><a class="code" href="classcsMath3.html#13a027c3c6b37b96dca288c481ecabda">00110</a> <span class="keyword">static</span> <span class="keywordtype">void</span> SetMinMax (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v, <a name="l00111"></a>00111 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& min, <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& max) <a name="l00112"></a>00112 { <a name="l00113"></a>00113 <span class="keywordflow">if</span> (v.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a> > max.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a>) max.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a> = v.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a>; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (v.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a> < min.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a> ) min.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a> = v.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a>; <a name="l00114"></a>00114 <span class="keywordflow">if</span> (v.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a> > max.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a>) max.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a> = v.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a>; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (v.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a> < min.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a> ) min.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a> = v.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a>; <a name="l00115"></a>00115 <span class="keywordflow">if</span> (v.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a> > max.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a>) max.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a> = v.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a>; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (v.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a> < min.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a> ) min.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a> = v.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a>; <a name="l00116"></a>00116 } <a name="l00117"></a>00117 <a name="l00123"></a><a class="code" href="classcsMath3.html#a9d1991cd5dedc1e916f9421a72f7fcc">00123</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">float</span> DoubleArea3 (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> &a, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> &b, <a name="l00124"></a>00124 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> &c) <a name="l00125"></a>00125 { <a name="l00126"></a>00126 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> v1 = b - a; <a name="l00127"></a>00127 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> v2 = c - a; <a name="l00128"></a>00128 <span class="keywordflow">return</span> (v1 % v2).<a class="code" href="classcsVector3.html#42b1546a61c4fd76ec17c50592fcad1e" title="Returns the norm of this vector.">Norm</a> (); <a name="l00129"></a>00129 } <a name="l00130"></a>00130 <a name="l00134"></a><a class="code" href="classcsMath3.html#2dbd709ddc25ba5ce02bc6e5a4ec2754">00134</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">float</span> Direction3 (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> &a, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> &b, <a name="l00135"></a>00135 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> &c) <a name="l00136"></a>00136 { <a name="l00137"></a>00137 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> v1 = b - a; <a name="l00138"></a>00138 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> v2 = c - a; <a name="l00139"></a>00139 <span class="keywordflow">return</span> ((v1.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a> * v2.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a> + v1.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a> * v2.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a> + v1.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a> * v2.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a>) - <a name="l00140"></a>00140 (v1.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a> * v2.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a> + v1.<a class="code" href="classcsVector3.html#823fdba459ff91e8a5e6834ded7c815f" title="The X component of the vector.">x</a> * v2.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a> + v1.<a class="code" href="classcsVector3.html#3f761bd195c7ccec59ea863a87a1ad05" title="The Z component of the vector.">z</a> * v2.<a class="code" href="classcsVector3.html#e0a74264b61eb5d61da63b3c101af719" title="The Y component of the vector.">y</a>)); <a name="l00141"></a>00141 } <a name="l00142"></a>00142 <a name="l00148"></a><a class="code" href="classcsMath3.html#f4821428b82a76796b83384bf3761235">00148</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">void</span> CalcNormal (<a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& norm, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v1, <a name="l00149"></a>00149 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v2, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v3) <a name="l00150"></a>00150 { <a name="l00151"></a>00151 norm = (v1-v2)%(v1-v3); <a name="l00152"></a>00152 } <a name="l00153"></a>00153 <a name="l00159"></a><a class="code" href="classcsMath3.html#41a229683728c5ddea0adb1c8215efce">00159</a> <span class="keyword">static</span> <span class="keywordtype">void</span> CalcNormal (<a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& norm, <a name="l00160"></a>00160 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& u) <a name="l00161"></a>00161 { norm = u%v; <span class="comment">/* NOT v%u - vertexes are defined clockwise */</span> } <a name="l00162"></a>00162 <a name="l00169"></a><a class="code" href="classcsMath3.html#1a1b3e612e65cc3a3df8ba38f27282d2">00169</a> <span class="keyword">static</span> <span class="keywordtype">void</span> CalcPlane (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v1, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v2, <a name="l00170"></a>00170 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v3, <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& normal, <span class="keywordtype">float</span>& D) <a name="l00171"></a>00171 { <a name="l00172"></a>00172 CalcNormal (normal, v1, v2, v3); <a name="l00173"></a>00173 D = - (normal * v1); <a name="l00174"></a>00174 } <a name="l00175"></a>00175 <a name="l00182"></a><a class="code" href="classcsMath3.html#0904c942e64bbd57400807e285c48d8f">00182</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> PlanesEqual (<span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& p1, <span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& p2) <a name="l00183"></a>00183 { <a name="l00184"></a>00184 <span class="keywordflow">return</span> ( ( p1.<a class="code" href="classcsPlane3.html#234f9daa8ee7fbb77ba431ac11e1d88c" title="The normal vector (or the (A,B,C) components).">norm</a> - p2.<a class="code" href="classcsPlane3.html#234f9daa8ee7fbb77ba431ac11e1d88c" title="The normal vector (or the (A,B,C) components).">norm</a>) < (<span class="keywordtype">float</span>).001 ) && <a name="l00185"></a>00185 ( <a class="code" href="group__geom__utils.html#g996f7be338ccb40d1a2a5abc1ad61759">ABS</a> (p1.<a class="code" href="classcsPlane3.html#a217e665f4f80f7fdb0d792e0d7b86d9" title="The D component of the plane.">DD</a>-p2.<a class="code" href="classcsPlane3.html#a217e665f4f80f7fdb0d792e0d7b86d9" title="The D component of the plane.">DD</a>) < (float).001 ); <a name="l00186"></a>00186 } <a name="l00187"></a>00187 <a name="l00193"></a>00193 <span class="keyword">static</span> <span class="keywordtype">bool</span> PlanesClose (<span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& p1, <span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& p2); <a name="l00194"></a>00194 <a name="l00202"></a>00202 <span class="keyword">static</span> <span class="keywordtype">int</span> OuterPlanes (<span class="keyword">const</span> <a class="code" href="classcsBox3.html" title="A bounding box in 3D space.">csBox3</a>& box1, <span class="keyword">const</span> <a class="code" href="classcsBox3.html" title="A bounding box in 3D space.">csBox3</a>& box2, <a name="l00203"></a>00203 <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>* planes); <a name="l00204"></a>00204 <a name="l00212"></a>00212 <span class="keyword">static</span> <span class="keywordtype">int</span> FindObserverSides (<span class="keyword">const</span> <a class="code" href="classcsBox3.html" title="A bounding box in 3D space.">csBox3</a>& box1, <span class="keyword">const</span> <a class="code" href="classcsBox3.html" title="A bounding box in 3D space.">csBox3</a>& box2, <a name="l00213"></a>00213 <span class="keywordtype">int</span>* sides); <a name="l00214"></a>00214 <a name="l00220"></a>00220 <span class="keyword">static</span> <span class="keywordtype">void</span> SpherePosition (<span class="keywordtype">float</span> angle_xz, <span class="keywordtype">float</span> angle_vert, <a name="l00221"></a>00221 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& pos); <a name="l00222"></a>00222 }; <a name="l00223"></a>00223 <a name="l00228"></a><a class="code" href="classcsSquaredDist.html">00228</a> <span class="keyword">class </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsSquaredDist.html" title="Some functions to perform squared distance calculations.">csSquaredDist</a> <a name="l00229"></a>00229 { <a name="l00230"></a>00230 <span class="keyword">public</span>: <a name="l00232"></a><a class="code" href="classcsSquaredDist.html#a2eaa8b79179bc43f05fd9398dd09bc3">00232</a> <span class="keyword">static</span> <span class="keywordtype">float</span> PointPoint (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& p1, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& p2) <a name="l00233"></a>00233 { <a name="l00234"></a>00234 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> d = (p1-p2); <a name="l00235"></a>00235 <span class="keywordflow">return</span> d*d; <a name="l00236"></a>00236 } <a name="l00237"></a>00237 <a name="l00239"></a>00239 <span class="keyword">static</span> <span class="keywordtype">float</span> PointLine (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& p, <a name="l00240"></a>00240 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& l1, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& l2); <a name="l00241"></a>00241 <a name="l00243"></a><a class="code" href="classcsSquaredDist.html#56206c38cbb732f8789bd9540f83e5ae">00243</a> <span class="keyword">static</span> <span class="keywordtype">float</span> PointPlane (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& p, <span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& plane) <a name="l00244"></a>00244 { <span class="keywordtype">float</span> r = plane.<a class="code" href="classcsPlane3.html#4fc26da8112f45f27271c6faf244ab65" title="Classify the given vector with regards to this plane.">Classify</a> (p); <span class="keywordflow">return</span> r * r; } <a name="l00245"></a>00245 <a name="l00252"></a>00252 <span class="keyword">static</span> <span class="keywordtype">float</span> PointPoly (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& p, <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> *V, <span class="keywordtype">int</span> n, <a name="l00253"></a>00253 <span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& plane, <span class="keywordtype">float</span> sqdist = -1); <a name="l00254"></a>00254 }; <a name="l00255"></a>00255 <a name="l00261"></a><a class="code" href="classcsIntersect3.html">00261</a> <span class="keyword">class </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsIntersect3.html" title="Some functions to perform various intersection calculations with 3D line segments...">csIntersect3</a> <a name="l00262"></a>00262 { <a name="l00263"></a>00263 <span class="keyword">private</span>: <a name="l00264"></a>00264 <span class="keyword">static</span> <span class="keywordtype">bool</span> BoxPlaneInternal (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& normal, <a name="l00265"></a>00265 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& vert, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& boxhalfsize); <a name="l00266"></a>00266 <a name="l00267"></a>00267 <span class="keyword">public</span>: <a name="l00274"></a>00274 <span class="keyword">static</span> <span class="keywordtype">bool</span> PlanePolygon (<span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& plane, <a class="code" href="classcsPoly3D.html" title="The following class represents a general 3D polygon.">csPoly3D</a>* poly, <a name="l00275"></a>00275 <a class="code" href="classcsSegment3.html" title="A 3D line segment.">csSegment3</a>& segment); <a name="l00276"></a>00276 <a name="l00286"></a>00286 <span class="keyword">static</span> <span class="keywordtype">int</span> SegmentFrustum (<a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>* planes, <span class="keywordtype">int</span> num_planes, <a name="l00287"></a>00287 <a class="code" href="classcsSegment3.html" title="A 3D line segment.">csSegment3</a>& seg); <a name="l00288"></a>00288 <a name="l00295"></a>00295 <span class="keyword">static</span> <span class="keywordtype">bool</span> SegmentTriangle (<span class="keyword">const</span> <a class="code" href="classcsSegment3.html" title="A 3D line segment.">csSegment3</a>& seg, <a name="l00296"></a>00296 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& tr1, <a name="l00297"></a>00297 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& tr2, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& tr3, <a name="l00298"></a>00298 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect); <a name="l00299"></a>00299 <a name="l00307"></a>00307 <span class="keyword">static</span> <span class="keywordtype">bool</span> SegmentPolygon (<span class="keyword">const</span> <a class="code" href="classcsSegment3.html" title="A 3D line segment.">csSegment3</a>& seg, <span class="keyword">const</span> <a class="code" href="classcsPoly3D.html" title="The following class represents a general 3D polygon.">csPoly3D</a>& poly, <a name="l00308"></a>00308 <span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& poly_plane, <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect); <a name="l00309"></a>00309 <a name="l00318"></a>00318 <span class="keyword">static</span> <span class="keywordtype">bool</span> SegmentPlanes ( <a name="l00319"></a>00319 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& u, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v, <a name="l00320"></a>00320 <span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>* planes, <span class="keywordtype">int</span> length, <a name="l00321"></a>00321 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect, <span class="keywordtype">float</span>& dist); <a name="l00322"></a>00322 <a name="l00328"></a>00328 <span class="keyword">static</span> <span class="keywordtype">bool</span> SegmentPlane ( <a name="l00329"></a>00329 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& u, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v, <a name="l00330"></a>00330 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& normal, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& a, <span class="comment">// plane</span> <a name="l00331"></a>00331 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect, <span class="keywordtype">float</span>& dist); <span class="comment">// intersection point</span> <a name="l00332"></a>00332 <a name="l00338"></a>00338 <span class="keyword">static</span> <span class="keywordtype">bool</span> SegmentPlane ( <a name="l00339"></a>00339 <span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& plane, <a name="l00340"></a>00340 <a class="code" href="classcsSegment3.html" title="A 3D line segment.">csSegment3</a>& segment); <a name="l00341"></a>00341 <a name="l00364"></a>00364 <span class="keyword">static</span> <span class="keywordtype">bool</span> SegmentPlane ( <a name="l00365"></a>00365 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& u, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v, <a name="l00366"></a>00366 <span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& p, <span class="comment">// plane Ax+By+Cz+D=0</span> <a name="l00367"></a>00367 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect, <span class="comment">// intersection point</span> <a name="l00368"></a>00368 <span class="keywordtype">float</span>& dist); <span class="comment">// distance from u to isect</span> <a name="l00369"></a>00369 <a name="l00376"></a>00376 <span class="keyword">static</span> <span class="keywordtype">bool</span> ThreePlanes (<span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& p1, <span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& p2, <a name="l00377"></a>00377 <span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& p3, <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect); <a name="l00378"></a>00378 <a name="l00385"></a>00385 <span class="keyword">static</span> <span class="keywordtype">bool</span> PlaneXPlane (<span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& p1, <span class="keywordtype">float</span> x2, <a class="code" href="classcsPlane2.html" title="A plane in 2D space.">csPlane2</a>& isect); <a name="l00386"></a>00386 <a name="l00393"></a>00393 <span class="keyword">static</span> <span class="keywordtype">bool</span> PlaneYPlane (<span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& p1, <span class="keywordtype">float</span> y2, <a class="code" href="classcsPlane2.html" title="A plane in 2D space.">csPlane2</a>& isect); <a name="l00394"></a>00394 <a name="l00401"></a>00401 <span class="keyword">static</span> <span class="keywordtype">bool</span> PlaneZPlane (<span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& p1, <span class="keywordtype">float</span> z2, <a class="code" href="classcsPlane2.html" title="A plane in 2D space.">csPlane2</a>& isect); <a name="l00402"></a>00402 <a name="l00409"></a><a class="code" href="classcsIntersect3.html#5e45702fc163866028087e8c0b9d5b4b">00409</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> PlaneAxisPlane (<span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& p1, <span class="keywordtype">int</span> nr, <span class="keywordtype">float</span> pos, <a name="l00410"></a>00410 <a class="code" href="classcsPlane2.html" title="A plane in 2D space.">csPlane2</a>& isect) <a name="l00411"></a>00411 { <a name="l00412"></a>00412 <span class="keywordflow">switch</span> (nr) <a name="l00413"></a>00413 { <a name="l00414"></a>00414 <span class="keywordflow">case</span> 0: <span class="keywordflow">return</span> PlaneXPlane (p1, pos, isect); <a name="l00415"></a>00415 <span class="keywordflow">case</span> 1: <span class="keywordflow">return</span> PlaneYPlane (p1, pos, isect); <a name="l00416"></a>00416 <span class="keywordflow">case</span> 2: <span class="keywordflow">return</span> PlaneZPlane (p1, pos, isect); <a name="l00417"></a>00417 } <a name="l00418"></a>00418 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00419"></a>00419 } <a name="l00420"></a>00420 <a name="l00427"></a>00427 <span class="keyword">static</span> <span class="keywordtype">float</span> SegmentZ0Plane ( <a name="l00428"></a>00428 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v1, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v2, <a name="l00429"></a>00429 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect); <span class="comment">// intersection point</span> <a name="l00430"></a>00430 <a name="l00437"></a><a class="code" href="classcsIntersect3.html#1696d1fa6ba52133f3e603633aebb67f">00437</a> <span class="keyword">static</span> <span class="keywordtype">float</span> SegmentZ0Plane ( <a name="l00438"></a>00438 <span class="keyword">const</span> <a class="code" href="classcsSegment3.html" title="A 3D line segment.">csSegment3</a>& uv, <a name="l00439"></a>00439 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect) <span class="comment">// intersection point</span> <a name="l00440"></a>00440 { <a name="l00441"></a>00441 <span class="keywordflow">return</span> SegmentZ0Plane (uv.<a class="code" href="classcsSegment3.html#e8e48008356e3415af9029e97b36b4fe" title="Get the start of the segment.">Start</a> (), uv.<a class="code" href="classcsSegment3.html#86a7c7129da99c2c29cc83213cef732d" title="Get the end of the segment.">End</a> (), isect); <a name="l00442"></a>00442 } <a name="l00443"></a>00443 <a name="l00450"></a>00450 <span class="keyword">static</span> <span class="keywordtype">float</span> SegmentXPlane ( <a name="l00451"></a>00451 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& u, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v, <a name="l00452"></a>00452 <span class="keywordtype">float</span> xval, <a name="l00453"></a>00453 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect); <span class="comment">// intersection point</span> <a name="l00454"></a>00454 <a name="l00461"></a><a class="code" href="classcsIntersect3.html#68aefd80a7185b18965c75c4fa52fb01">00461</a> <span class="keyword">static</span> <span class="keywordtype">float</span> SegmentXPlane ( <a name="l00462"></a>00462 <span class="keyword">const</span> <a class="code" href="classcsSegment3.html" title="A 3D line segment.">csSegment3</a>& uv, <a name="l00463"></a>00463 <span class="keywordtype">float</span> xval, <a name="l00464"></a>00464 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect) <span class="comment">// intersection point</span> <a name="l00465"></a>00465 { <a name="l00466"></a>00466 <span class="keywordflow">return</span> SegmentXPlane (uv.<a class="code" href="classcsSegment3.html#e8e48008356e3415af9029e97b36b4fe" title="Get the start of the segment.">Start</a> (), uv.<a class="code" href="classcsSegment3.html#86a7c7129da99c2c29cc83213cef732d" title="Get the end of the segment.">End</a> (), xval, isect); <a name="l00467"></a>00467 } <a name="l00468"></a>00468 <a name="l00475"></a>00475 <span class="keyword">static</span> <span class="keywordtype">float</span> SegmentYPlane ( <a name="l00476"></a>00476 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& u, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v, <a name="l00477"></a>00477 <span class="keywordtype">float</span> yval, <span class="comment">// plane y = yval</span> <a name="l00478"></a>00478 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect); <span class="comment">// intersection point</span> <a name="l00479"></a>00479 <a name="l00486"></a><a class="code" href="classcsIntersect3.html#e33c06af209a45995be8a47cf6afb77c">00486</a> <span class="keyword">static</span> <span class="keywordtype">float</span> SegmentYPlane ( <a name="l00487"></a>00487 <span class="keyword">const</span> <a class="code" href="classcsSegment3.html" title="A 3D line segment.">csSegment3</a>& uv, <a name="l00488"></a>00488 <span class="keywordtype">float</span> yval, <span class="comment">// plane y = yval</span> <a name="l00489"></a>00489 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect) <span class="comment">// intersection point</span> <a name="l00490"></a>00490 { <a name="l00491"></a>00491 <span class="keywordflow">return</span> SegmentYPlane (uv.<a class="code" href="classcsSegment3.html#e8e48008356e3415af9029e97b36b4fe" title="Get the start of the segment.">Start</a> (), uv.<a class="code" href="classcsSegment3.html#86a7c7129da99c2c29cc83213cef732d" title="Get the end of the segment.">End</a> (), yval, isect); <a name="l00492"></a>00492 } <a name="l00493"></a>00493 <a name="l00500"></a>00500 <span class="keyword">static</span> <span class="keywordtype">float</span> SegmentZPlane ( <a name="l00501"></a>00501 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& u, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v, <a name="l00502"></a>00502 <span class="keywordtype">float</span> zval, <span class="comment">// plane z = zval</span> <a name="l00503"></a>00503 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect); <span class="comment">// intersection point</span> <a name="l00504"></a>00504 <a name="l00511"></a><a class="code" href="classcsIntersect3.html#b93cdb51a4501bc0814e8def7252eb1c">00511</a> <span class="keyword">static</span> <span class="keywordtype">float</span> SegmentZPlane ( <a name="l00512"></a>00512 <span class="keyword">const</span> <a class="code" href="classcsSegment3.html" title="A 3D line segment.">csSegment3</a>& uv, <a name="l00513"></a>00513 <span class="keywordtype">float</span> zval, <span class="comment">// plane z = zval</span> <a name="l00514"></a>00514 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect) <span class="comment">// intersection point</span> <a name="l00515"></a>00515 { <a name="l00516"></a>00516 <span class="keywordflow">return</span> SegmentZPlane (uv.<a class="code" href="classcsSegment3.html#e8e48008356e3415af9029e97b36b4fe" title="Get the start of the segment.">Start</a> (), uv.<a class="code" href="classcsSegment3.html#86a7c7129da99c2c29cc83213cef732d" title="Get the end of the segment.">End</a> (), zval, isect); <a name="l00517"></a>00517 } <a name="l00518"></a>00518 <a name="l00525"></a><a class="code" href="classcsIntersect3.html#7fa41e32e8c144012e3372aa356a0800">00525</a> <span class="keyword">static</span> <span class="keywordtype">float</span> SegmentAxisPlane (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& u, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v, <a name="l00526"></a>00526 <span class="keywordtype">int</span> nr, <span class="keywordtype">float</span> pos, <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect) <a name="l00527"></a>00527 { <a name="l00528"></a>00528 <span class="keywordflow">switch</span> (nr) <a name="l00529"></a>00529 { <a name="l00530"></a>00530 <span class="keywordflow">case</span> 0: <span class="keywordflow">return</span> SegmentXPlane (u, v, pos, isect); <a name="l00531"></a>00531 <span class="keywordflow">case</span> 1: <span class="keywordflow">return</span> SegmentYPlane (u, v, pos, isect); <a name="l00532"></a>00532 <span class="keywordflow">case</span> 2: <span class="keywordflow">return</span> SegmentZPlane (u, v, pos, isect); <a name="l00533"></a>00533 } <a name="l00534"></a>00534 <span class="keywordflow">return</span> 0.0; <a name="l00535"></a>00535 } <a name="l00536"></a>00536 <a name="l00541"></a>00541 <span class="keyword">static</span> <span class="keywordtype">float</span> SegmentXFrustum ( <a name="l00542"></a>00542 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& u, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v, <span class="keywordtype">float</span> A, <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect); <a name="l00543"></a>00543 <a name="l00548"></a><a class="code" href="classcsIntersect3.html#b7b70e43effc9647fef4446b8c983531">00548</a> <span class="keyword">static</span> <span class="keywordtype">float</span> SegmentXFrustum ( <a name="l00549"></a>00549 <span class="keyword">const</span> <a class="code" href="classcsSegment3.html" title="A 3D line segment.">csSegment3</a>& uv, <span class="keywordtype">float</span> A, <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect) <a name="l00550"></a>00550 { <a name="l00551"></a>00551 <span class="keywordflow">return</span> SegmentXFrustum (uv.<a class="code" href="classcsSegment3.html#e8e48008356e3415af9029e97b36b4fe" title="Get the start of the segment.">Start</a> (), uv.<a class="code" href="classcsSegment3.html#86a7c7129da99c2c29cc83213cef732d" title="Get the end of the segment.">End</a> (), A, isect); <a name="l00552"></a>00552 } <a name="l00553"></a>00553 <a name="l00558"></a>00558 <span class="keyword">static</span> <span class="keywordtype">float</span> SegmentYFrustum ( <a name="l00559"></a>00559 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& u, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& v, <span class="keywordtype">float</span> B, <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect); <a name="l00560"></a>00560 <a name="l00565"></a><a class="code" href="classcsIntersect3.html#7e7cd20eae21dc0a52c54e56be7c174e">00565</a> <span class="keyword">static</span> <span class="keywordtype">float</span> SegmentYFrustum ( <a name="l00566"></a>00566 <span class="keyword">const</span> <a class="code" href="classcsSegment3.html" title="A 3D line segment.">csSegment3</a>& uv, <span class="keywordtype">float</span> B, <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect) <a name="l00567"></a>00567 { <a name="l00568"></a>00568 <span class="keywordflow">return</span> SegmentYFrustum (uv.<a class="code" href="classcsSegment3.html#e8e48008356e3415af9029e97b36b4fe" title="Get the start of the segment.">Start</a> (), uv.<a class="code" href="classcsSegment3.html#86a7c7129da99c2c29cc83213cef732d" title="Get the end of the segment.">End</a> (), B, isect); <a name="l00569"></a>00569 } <a name="l00570"></a>00570 <a name="l00589"></a>00589 <span class="keyword">static</span> <span class="keywordtype">int</span> BoxSegment (<span class="keyword">const</span> <a class="code" href="classcsBox3.html" title="A bounding box in 3D space.">csBox3</a>& box, <span class="keyword">const</span> <a class="code" href="classcsSegment3.html" title="A 3D line segment.">csSegment3</a>& segment, <a name="l00590"></a>00590 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& isect, <span class="keywordtype">float</span>* pr = 0, <span class="keywordtype">bool</span> use_ray = <span class="keyword">false</span>); <a name="l00591"></a>00591 <a name="l00600"></a>00600 <span class="keyword">static</span> <span class="keywordtype">bool</span> ClipSegmentBox (<a class="code" href="classcsSegment3.html" title="A 3D line segment.">csSegment3</a>& segment, <span class="keyword">const</span> <a class="code" href="classcsBox3.html" title="A bounding box in 3D space.">csBox3</a>& box, <a name="l00601"></a>00601 <span class="keywordtype">bool</span> use_ray = <span class="keyword">false</span>); <a name="l00602"></a>00602 <a name="l00612"></a>00612 <span class="keyword">static</span> <span class="keywordtype">bool</span> BoxFrustum (<span class="keyword">const</span> <a class="code" href="classcsBox3.html" title="A bounding box in 3D space.">csBox3</a>& box, <span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>* frustum, <a name="l00613"></a>00613 <a class="code" href="group__util.html#g1134b580f8da4de94ca6b1de4d37975e" title="unsigned 32-bit integer (0..4 294 967 295)">uint32</a> inClipMask, <a class="code" href="group__util.html#g1134b580f8da4de94ca6b1de4d37975e" title="unsigned 32-bit integer (0..4 294 967 295)">uint32</a>& outClipMask); <a name="l00614"></a>00614 <a name="l00618"></a>00618 <span class="keyword">static</span> <span class="keywordtype">bool</span> BoxFrustum (<span class="keyword">const</span> <a class="code" href="classcsBox3.html" title="A bounding box in 3D space.">csBox3</a>& box, <span class="keyword">const</span> <a class="code" href="classcsFrustum.html" title="A general frustum.">csFrustum</a>* frustum); <a name="l00619"></a>00619 <a name="l00624"></a>00624 <span class="keyword">static</span> <span class="keywordtype">bool</span> BoxSphere (<span class="keyword">const</span> <a class="code" href="classcsBox3.html" title="A bounding box in 3D space.">csBox3</a>& box, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& center, <a name="l00625"></a>00625 <span class="keywordtype">float</span> sqradius); <a name="l00626"></a>00626 <a name="l00630"></a>00630 <span class="keyword">static</span> <span class="keywordtype">bool</span> BoxPlane (<span class="keyword">const</span> <a class="code" href="classcsBox3.html" title="A bounding box in 3D space.">csBox3</a>& box, <span class="keyword">const</span> <a class="code" href="classcsPlane3.html" title="A plane in 3D space.">csPlane3</a>& plane); <a name="l00631"></a>00631 <a name="l00636"></a>00636 <span class="keyword">static</span> <span class="keywordtype">bool</span> BoxPlane (<span class="keyword">const</span> <a class="code" href="classcsBox3.html" title="A bounding box in 3D space.">csBox3</a>& box, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& normal, <a name="l00637"></a>00637 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& vert); <a name="l00638"></a>00638 <a name="l00642"></a>00642 <span class="keyword">static</span> <span class="keywordtype">bool</span> BoxTriangle (<span class="keyword">const</span> <a class="code" href="classcsBox3.html" title="A bounding box in 3D space.">csBox3</a>& box, <a name="l00643"></a>00643 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& tri0, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& tri1, <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>& tri2); <a name="l00644"></a>00644 <a name="l00648"></a><a class="code" href="classcsIntersect3.html#f10fb75c5164ef7175cae5328f93db25">00648</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> BoxBox (<span class="keyword">const</span> <a class="code" href="classcsBox3.html" title="A bounding box in 3D space.">csBox3</a>& box1, <span class="keyword">const</span> <a class="code" href="classcsBox3.html" title="A bounding box in 3D space.">csBox3</a>& box2) <a name="l00649"></a>00649 { <a name="l00650"></a>00650 <span class="keywordflow">return</span> box1.<a class="code" href="classcsBox3.html#39bdacf224add82c37748e380a558cd2" title="Test if the two boxes have an intersection.">TestIntersect</a> (box2); <a name="l00651"></a>00651 } <a name="l00652"></a>00652 <a name="l00656"></a><a class="code" href="classcsIntersect3.html#6defc3e0c1bf9e72cfad5bbf7ff3d4d2">00656</a> <span class="keyword">static</span> <a class="code" href="classcsPtr.html" title="A pointer encapsulator.">csPtr<csFrustum></a> FrustumFrustum (<span class="keyword">const</span> <a class="code" href="classcsFrustum.html" title="A general frustum.">csFrustum</a>& f1, <a name="l00657"></a>00657 <span class="keyword">const</span> <a class="code" href="classcsFrustum.html" title="A general frustum.">csFrustum</a>& f2) <a name="l00658"></a>00658 { <a name="l00659"></a>00659 <span class="keywordflow">return</span> f1.<a class="code" href="classcsFrustum.html#5abadb39e9cf881586adee3e910d8f69" title="Intersect with another frustum.">Intersect</a> (f2); <a name="l00660"></a>00660 } <a name="l00661"></a>00661 <a name="l00665"></a><a class="code" href="classcsIntersect3.html#16e0180d263c349705d0acd46ca7a9be">00665</a> <span class="keyword">static</span> <a class="code" href="classcsPtr.html" title="A pointer encapsulator.">csPtr<csFrustum></a> FrustumFrustum (<span class="keyword">const</span> <a class="code" href="classcsFrustum.html" title="A general frustum.">csFrustum</a>& f1, <a name="l00666"></a>00666 <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a>* poly, <span class="keywordtype">int</span> num) <a name="l00667"></a>00667 { <a name="l00668"></a>00668 <span class="keywordflow">return</span> f1.<a class="code" href="classcsFrustum.html#5abadb39e9cf881586adee3e910d8f69" title="Intersect with another frustum.">Intersect</a> (poly, num); <a name="l00669"></a>00669 } <a name="l00670"></a>00670 <a name="l00677"></a>00677 <span class="keyword">static</span> <span class="keywordtype">bool</span> TriangleTriangle (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> tri1[3], <a name="l00678"></a>00678 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> tri2[3]); <a name="l00679"></a>00679 <a name="l00689"></a>00689 <span class="keyword">static</span> <span class="keywordtype">bool</span> TriangleTriangle (<span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> tri1[3], <a name="l00690"></a>00690 <span class="keyword">const</span> <a class="code" href="classcsVector3.html" title="A 3D vector.">csVector3</a> tri2[3], <a name="l00691"></a>00691 <a class="code" href="classcsSegment3.html" title="A 3D line segment.">csSegment3</a>& isectline, <span class="keywordtype">bool</span>& coplanar); <a name="l00692"></a>00692 }; <a name="l00693"></a>00693 <a name="l00698"></a><a class="code" href="classcsGeomDebugHelper.html">00698</a> <span class="keyword">class </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsGeomDebugHelper.html" title="This is a class that does unit testing (and other debug stuff) for most of csgeom...">csGeomDebugHelper</a> : <a name="l00699"></a>00699 <span class="keyword">public</span> <a class="code" href="classscfImplementation1.html">scfImplementation1</a><csGeomDebugHelper, iDebugHelper> <a name="l00700"></a>00700 { <a name="l00701"></a>00701 <span class="keyword">public</span>: <a name="l00702"></a>00702 <a class="code" href="classcsGeomDebugHelper.html" title="This is a class that does unit testing (and other debug stuff) for most of csgeom...">csGeomDebugHelper</a> (); <a name="l00703"></a>00703 <span class="keyword">virtual</span> ~<a class="code" href="classcsGeomDebugHelper.html" title="This is a class that does unit testing (and other debug stuff) for most of csgeom...">csGeomDebugHelper</a> (); <a name="l00704"></a>00704 <a name="l00705"></a><a class="code" href="classcsGeomDebugHelper.html#9dde7df87f36bc24aac6a182a93b166a">00705</a> <span class="keyword">virtual</span> <span class="keywordtype">int</span> GetSupportedTests ()<span class="keyword"> const</span> <a name="l00706"></a>00706 <span class="keyword"> </span>{ <a name="l00707"></a>00707 <span class="keywordflow">return</span> <a class="code" href="group__util.html#gca559d327ade26b0b01a4b81971425da" title="supports UnitTest().">CS_DBGHELP_UNITTEST</a>; <a name="l00708"></a>00708 } <a name="l00709"></a>00709 <span class="keyword">virtual</span> <a class="code" href="classcsPtr.html" title="A pointer encapsulator.">csPtr<iString></a> UnitTest (); <a name="l00710"></a><a class="code" href="classcsGeomDebugHelper.html#b0185b1cf8381603272994299bafa714">00710</a> <span class="keyword">virtual</span> <a class="code" href="classcsPtr.html" title="A pointer encapsulator.">csPtr<iString></a> StateTest () <a name="l00711"></a>00711 { <a name="l00712"></a>00712 <span class="keywordflow">return</span> 0; <a name="l00713"></a>00713 } <a name="l00714"></a><a class="code" href="classcsGeomDebugHelper.html#acad9aa80f37ae736179d8ed3497724b">00714</a> <span class="keyword">virtual</span> <a class="code" href="group__util.html#g28e82998c4c2d1197a1d412bba7da793" title="A time value measured in milliseconds (1/1000 of a second).">csTicks</a> Benchmark (<span class="keywordtype">int</span> <span class="comment">/*num_iterations*/</span>) <a name="l00715"></a>00715 { <a name="l00716"></a>00716 <span class="keywordflow">return</span> 0; <a name="l00717"></a>00717 } <a name="l00718"></a><a class="code" href="classcsGeomDebugHelper.html#845d93026c9b21c326bdaa42553b76e1">00718</a> <span class="keyword">virtual</span> <a class="code" href="classcsPtr.html" title="A pointer encapsulator.">csPtr<iString></a> Dump () <a name="l00719"></a>00719 { <a name="l00720"></a>00720 <span class="keywordflow">return</span> 0; <a name="l00721"></a>00721 } <a name="l00722"></a><a class="code" href="classcsGeomDebugHelper.html#4a2b0c27c0c3007e179a48995111a7be">00722</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> Dump (<a class="code" href="structiGraphics3D.html" title="This is the standard 3D graphics interface.">iGraphics3D</a>* <span class="comment">/*g3d*/</span>) <a name="l00723"></a>00723 { <a name="l00724"></a>00724 } <a name="l00725"></a><a class="code" href="classcsGeomDebugHelper.html#8f4e36efccc2a832e0d30f56b6adca7e">00725</a> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> DebugCommand (<span class="keyword">const</span> <span class="keywordtype">char</span>*) <a name="l00726"></a>00726 { <a name="l00727"></a>00727 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00728"></a>00728 } <a name="l00729"></a>00729 }; <a name="l00730"></a>00730 <a name="l00733"></a>00733 <span class="preprocessor">#endif // __CS_MATH3D_H__</span> <a name="l00734"></a>00734 <span class="preprocessor"></span> </pre></div><hr size="1"><address><small>Generated for Crystal Space 1.2.1 by <a href="http://www.doxygen.org/index.html">doxygen</a> 1.5.3 </small></address> </div></body> </html>