<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta name="robots" content="noindex">
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>CollisionModel3D Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">
<!-- Generated by Doxygen 1.2.3 on Sat Nov 18 00:15:14 2000 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
<hr><h1>CollisionModel3D  Class Reference</h1><code>#include &lt;<a class="el" href="coldet_h-source.html">coldet.h</a>&gt;</code>
<p>
<p>Inheritance diagram for CollisionModel3D:
<p><center><img src="class_CollisionModel3D.gif" usemap="#CollisionModel3D_map" border="0"></center>
<map name="CollisionModel3D_map">
<area href="class_CollisionModel3DImpl.html" alt="CollisionModel3DImpl" shape="rect" coords="0,56,133,80">
</map>
<a href="class_CollisionModel3D-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2><br><h2>Public Methods</h2></td></tr>
<tr><td nowrap align=right valign=top>virtual&nbsp;</td><td valign=bottom><a class="el" href="class_CollisionModel3D.html#a0">~CollisionModel3D</a> ()</td></tr>
<tr><td nowrap align=right valign=top>virtual void&nbsp;</td><td valign=bottom><a class="el" href="class_CollisionModel3D.html#a1">setTriangleNumber</a> (int num) = 0</td></tr>
<tr><td nowrap align=right valign=top>virtual void&nbsp;</td><td valign=bottom><a class="el" href="class_CollisionModel3D.html#a2">addTriangle</a> (float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3) = 0</td></tr>
<tr><td nowrap align=right valign=top>virtual void&nbsp;</td><td valign=bottom><a class="el" href="class_CollisionModel3D.html#a3">addTriangle</a> (float v1[3], float v2[3], float v3[3]) = 0</td></tr>
<tr><td nowrap align=right valign=top>virtual void&nbsp;</td><td valign=bottom><a class="el" href="class_CollisionModel3D.html#a4">finalize</a> () = 0</td></tr>
<tr><td nowrap align=right valign=top>virtual void&nbsp;</td><td valign=bottom><a class="el" href="class_CollisionModel3D.html#a5">setTransform</a> (float m[16]) = 0</td></tr>
<tr><td nowrap align=right valign=top>virtual bool&nbsp;</td><td valign=bottom><a class="el" href="class_CollisionModel3D.html#a6">collision</a> (CollisionModel3D* other, int AccuracyDepth=-1, int MaxProcessingTime=0, float* other_transform=0) = 0</td></tr>
<tr><td nowrap align=right valign=top>virtual bool&nbsp;</td><td valign=bottom><a class="el" href="class_CollisionModel3D.html#a7">rayCollision</a> (float origin[3], float direction[3], bool closest=false, float segmin=0.0f, float segmax=3.4e+38F) = 0</td></tr>
<tr><td nowrap align=right valign=top>virtual bool&nbsp;</td><td valign=bottom><a class="el" href="class_CollisionModel3D.html#a8">sphereCollision</a> (float origin[3], float radius) = 0</td></tr>
<tr><td nowrap align=right valign=top>virtual bool&nbsp;</td><td valign=bottom><a class="el" href="class_CollisionModel3D.html#a9">getCollidingTriangles</a> (float t1[9], float t2[9], bool ModelSpace=true) = 0</td></tr>
<tr><td nowrap align=right valign=top>virtual bool&nbsp;</td><td valign=bottom><a class="el" href="class_CollisionModel3D.html#a10">getCollidingTriangles</a> (int&amp; t1, int&amp; t2) = 0</td></tr>
<tr><td nowrap align=right valign=top>virtual bool&nbsp;</td><td valign=bottom><a class="el" href="class_CollisionModel3D.html#a11">getCollisionPoint</a> (float p[3], bool ModelSpace=true) = 0</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Collision Model. Will represent the mesh to be tested for collisions. It has to be notified of all triangles, via <a class="el" href="class_CollisionModel3D.html#a2">addTriangle</a>() After all triangles are added, a call to <a class="el" href="class_CollisionModel3D.html#a4">finalize</a>() will process the information and prepare for collision tests. Call <a class="el" href="class_CollisionModel3D.html#a6">collision</a>() to check for a collision
<p>
Note: Transformations must not contain scaling. 
<p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a name="a0" doxytag="CollisionModel3D::~CollisionModel3D"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
CollisionModel3D::~CollisionModel3D (
          </b></td>
          <td valign="bottom"><b>
)<code> [inline, virtual]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a name="a3" doxytag="CollisionModel3D::addTriangle"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
virtual void CollisionModel3D::addTriangle (
          </b></td>
          <td valign="bottom"><b>
float <em>v1</em>[3], 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>v2</em>[3], 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>v3</em>[3]&nbsp;)<code> [pure virtual]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Reimplemented in <a class="el" href="class_CollisionModel3DImpl.html#a3">CollisionModel3DImpl</a>.    </td>
  </tr>
</table>
<a name="a2" doxytag="CollisionModel3D::addTriangle"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
void CollisionModel3D::addTriangle (
          </b></td>
          <td valign="bottom"><b>
float <em>x1</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>y1</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>z1</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>x2</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>y2</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>z2</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>x3</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>y3</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>z3</em>&nbsp;)<code> [pure virtual]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Use any of the forms of this functions to enter the coordinates of the model's triangles. 
<p>
Reimplemented in <a class="el" href="class_CollisionModel3DImpl.html#a2">CollisionModel3DImpl</a>.    </td>
  </tr>
</table>
<a name="a6" doxytag="CollisionModel3D::collision"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
bool CollisionModel3D::collision (
          </b></td>
          <td valign="bottom"><b>
CollisionModel3D * <em>other</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
int <em>AccuracyDepth</em> = -1, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
int <em>MaxProcessingTime</em> = 0, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float * <em>other_transform</em> = 0&nbsp;)<code> [pure virtual]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
<a class="el" href="class_Check.html">Check</a> for collision with another model. Do not mix model types here.
<p>
MaxProcessingTime determines the maximum time in milliseconds to check for collision. If a rejection is not found by that time, the function will return true.
<p>
AccuracyDepth is not yet supported.
<p>
other_transform allows overriding the other model's  transform, by supplying an alternative one. This can be useful when testing a model against itself with different orientations. 
<p>
Reimplemented in <a class="el" href="class_CollisionModel3DImpl.html#a8">CollisionModel3DImpl</a>.    </td>
  </tr>
</table>
<a name="a4" doxytag="CollisionModel3D::finalize"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
void CollisionModel3D::finalize (
          </b></td>
          <td valign="bottom"><b>
)<code> [pure virtual]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
All triangles have been added, process model. 
<p>
Reimplemented in <a class="el" href="class_CollisionModel3DImpl.html#a5">CollisionModel3DImpl</a>.    </td>
  </tr>
</table>
<a name="a10" doxytag="CollisionModel3D::getCollidingTriangles"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
bool CollisionModel3D::getCollidingTriangles (
          </b></td>
          <td valign="bottom"><b>
int &amp; <em>t1</em>, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
int &amp; <em>t2</em>&nbsp;)<code> [pure virtual]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Retrieve the pair of triangles indices that collided. Only valid after a call to <a class="el" href="class_CollisionModel3D.html#a6">collision</a>() that returned true. t1 belongs to _this_ model, while t2 is in the other one. 
<p>
Reimplemented in <a class="el" href="class_CollisionModel3DImpl.html#a12">CollisionModel3DImpl</a>.    </td>
  </tr>
</table>
<a name="a9" doxytag="CollisionModel3D::getCollidingTriangles"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
bool CollisionModel3D::getCollidingTriangles (
          </b></td>
          <td valign="bottom"><b>
float <em>t1</em>[9], 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>t2</em>[9], 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
bool <em>ModelSpace</em> = true&nbsp;)<code> [pure virtual]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Retrieve the pair of triangles that collided. Only valid after a call to <a class="el" href="class_CollisionModel3D.html#a6">collision</a>() that returned true. t1 is this model's triangle and t2 is the other one. In case of ray or sphere collision, only t1 will be valid. The coordinates will be in _this_ model's coordinate space, unless ModelSpace is false, in which case, coordinates will be transformed by the model's current transform to world space. 
<p>
Reimplemented in <a class="el" href="class_CollisionModel3DImpl.html#a11">CollisionModel3DImpl</a>.    </td>
  </tr>
</table>
<a name="a11" doxytag="CollisionModel3D::getCollisionPoint"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
bool CollisionModel3D::getCollisionPoint (
          </b></td>
          <td valign="bottom"><b>
float <em>p</em>[3], 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
bool <em>ModelSpace</em> = true&nbsp;)<code> [pure virtual]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Retrieve the detected collision point.  Only valid after a call to <a class="el" href="class_CollisionModel3D.html#a6">collision</a>() that returned true. The coordinates will be in _this_ model's coordinate space, unless ModelSpace is false, in which case, coordinates will be transformed by the model's current transform to world space. 
<p>
Reimplemented in <a class="el" href="class_CollisionModel3DImpl.html#a13">CollisionModel3DImpl</a>.    </td>
  </tr>
</table>
<a name="a7" doxytag="CollisionModel3D::rayCollision"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
bool CollisionModel3D::rayCollision (
          </b></td>
          <td valign="bottom"><b>
float <em>origin</em>[3], 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>direction</em>[3], 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
bool <em>closest</em> = false, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>segmin</em> = 0.0f, 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>segmax</em> = 3.4e+38F&nbsp;)<code> [pure virtual]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Returns true if the ray given in world space coordinates intersects with the object.  <a class="el" href="class_CollisionModel3D.html#a9">getCollidingTriangles</a>() and <a class="el" href="class_CollisionModel3D.html#a11">getCollisionPoint</a>() can be used to retrieve information about a collision. If closest if false, the first triangle that collides with the ray is used. Otherwise the closest one will be used. Closest triangle searching will slow the test considerably. The default ray is a standard infinite ray. However, using segmin and segmax you can define a line segment along the ray. 
<p>
Reimplemented in <a class="el" href="class_CollisionModel3DImpl.html#a9">CollisionModel3DImpl</a>.    </td>
  </tr>
</table>
<a name="a5" doxytag="CollisionModel3D::setTransform"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
void CollisionModel3D::setTransform (
          </b></td>
          <td valign="bottom"><b>
float <em>m</em>[16]&nbsp;)<code> [pure virtual]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
The the current affine matrix for the model. See transform.txt for format information 
<p>
Reimplemented in <a class="el" href="class_CollisionModel3DImpl.html#a6">CollisionModel3DImpl</a>.    </td>
  </tr>
</table>
<a name="a1" doxytag="CollisionModel3D::setTriangleNumber"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
void CollisionModel3D::setTriangleNumber (
          </b></td>
          <td valign="bottom"><b>
int <em>num</em>&nbsp;)<code> [pure virtual]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Optional: Optimization for construction speed. If you know the number of triangles. 
<p>
Reimplemented in <a class="el" href="class_CollisionModel3DImpl.html#a1">CollisionModel3DImpl</a>.    </td>
  </tr>
</table>
<a name="a8" doxytag="CollisionModel3D::sphereCollision"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td nowrap valign="top"><b> 
bool CollisionModel3D::sphereCollision (
          </b></td>
          <td valign="bottom"><b>
float <em>origin</em>[3], 
          </b></td>
        </tr>
        <tr>
          <td></td>
          <td><b>
float <em>radius</em>&nbsp;)<code> [pure virtual]</code>
          </b></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Returns true if the given sphere collides with the model. <a class="el" href="class_CollisionModel3D.html#a9">getCollidingTriangles</a>() and <a class="el" href="class_CollisionModel3D.html#a11">getCollisionPoint</a>() can be used to retrieve information about a collision. 
<p>
Reimplemented in <a class="el" href="class_CollisionModel3DImpl.html#a10">CollisionModel3DImpl</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="coldet_h-source.html">coldet.h</a></ul>
<hr><address><small>Generated at Sat Nov 18 00:15:14 2000 for coldet by
<a href="http://www.stack.nl/~dimitri/doxygen/index.html">
<img src="doxygen.gif" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.3 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
 &copy;&nbsp;1997-2000</small></address>
</body>
</html>
