Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RtIntersection
[Math Tools]


Functions

RwBool  RtIntersectionLineTriangle (RwV3d *lineStart, RwV3d *lineDelta, RwV3d *v0, RwV3d *v1, RwV3d *v2, RwReal *distance)
RwBool  RtIntersectionSphereTriangle (RwSphere *sphere, RwV3d *v0, RwV3d *v1, RwV3d *v2, RwV3d *normal, RwReal *distance)
RwBool  RtIntersectionBBoxTriangle (RwBBox *bbox, RwV3d *v0, RwV3d *v1, RwV3d *v2)

Detailed Description

Object Intersection Toolkit for RenderWare.

RtIntersection Toolkit Overview

Requirements

Overview

This toolkit provides functions for testing whether certain geometry primitives intersect. The following are provided:-

Function Documentation

RwBool RtIntersectionBBoxTriangle RwBBox   bbox,
RwV3d   v0,
RwV3d   v1,
RwV3d   v2
 

RtIntersectionBBoxTriangle tests for the intersection of a bounding box with a triangle.

Parameters:
bbox  Bounding box
v0  Triangle vertex 0
v1  Triangle vertex 1
v2  Triangle vertex 2
Returns:
Returns TRUE if an intersection is found, or FALSE otherwise.
RwBool RtIntersectionLineTriangle RwV3d   lineStart,
RwV3d   lineDelta,
RwV3d   v0,
RwV3d   v1,
RwV3d   v2,
RwReal   distance
 

RtIntersectionLineTriangle tests for the intersection of a line with a triangle, and if found, returns the parametric distance to the intersection along the line.

This function returns TRUE if the line, specified at the starting point lineStart (RwV3d) and a lineDelta (RwV3d) defining the displacement vector, intersects with the triangle (RwV3d).

The lineDelta parameter is used to reduce calculation overheads when processing a large number of triangles and can be obtained from RwV3dSub(lineDelta, &line.end, &line.start).

This function also takes another parameter, distance, which will hold the parametric distance to the intersection if an intersection was found.

This function use backface culling which means:

  • the order of the triangle vertices is very important
  • you will need to make two calls for two-sided tests
Parameters:
lineStart  Line start vertex
lineDelta  Line displacement vector
v0  Triangle vertex 0
v1  Triangle vertex 1
v2  Triangle vertex 2
distance  On return, contains parameteric distance to intersection
Returns:
Returns TRUE if an intersection is found, or FALSE otherwise.
RwBool RtIntersectionSphereTriangle RwSphere   sphere,
RwV3d   v0,
RwV3d   v1,
RwV3d   v2,
RwV3d   normal,
RwReal   distance
 

RtIntersectionSphereTriangle tests for the intersection of a sphere with a triangle, and if found, returns the triangle normal and the perpendicular distance of the sphere center from the plane of the triangle.

Parameters:
sphere  Sphere
v0  Triangle vertex 0
v1  Triangle vertex 1
v2  Triangle vertex 2
normal  If intersection is found, returns triangle normal
distance  If intersection is found, returns distance of sphere center from the plane of the triangle
Returns:
Returns TRUE if an intersection is found, or FALSE otherwise.

Criterion Software © 1993-2003 Criterion Software Limited. All rights reserved. Built Tue Apr 22 12:46:57 2003. Send Feedback
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)