Intercept functions
[Standard functions]

Functions for calculating intercepts. More...

Functions

GLboolean cluPlaneIntersect (const CLUplane *plane, const CLvertex *vertex)
GLboolean cluPlaneIntersectSphere (const CLUplane *plane, const CLUsphere *sphere)
GLboolean cluFrustumIntercept (const CLUfrustum *frustum, const CLvertex *vertex)
GLboolean cluFrustumInterceptSphere (const CLUfrustum *frustum, const CLUsphere *sphere)
GLboolean cluSphereIntersect (const CLUsphere *sphere, const CLvertex *vertex)
GLboolean cluSphereIntersectSphere (const CLUsphere *sphere0, const CLUsphere *sphere1)
GLboolean cluConeIntersect (const CLUcone *cone, const CLvertex *vertex)
GLboolean cluConeIntersectSphere (const CLUcone *cone, const CLUsphere *sphere)
bool cluRayIntersectSphere (float *t, const CLUray *ray, const CLUsphere *sphere)
 Calculates the intersection of a ray and a sphere.
bool cluRayIntersectTriangle (CLvertex *result, const CLUray *ray, const CLvertex *v0, const CLvertex *v1, const CLvertex *v2)
 Calculates the intersection between a ray and a triangle.
CLvertex * cluSetVertexRayT (CLvertex *vf, const CLUray *ray, float t)
 Sets the given vertex to a value calculated by a ray and offset (t) along the ray.
CLUraycluSetRayOriginDestination (CLUray *ray, CLvertex *origin, CLvertex *destination)
 Sets the value of a given ray based on the supplied origin and destination.

Detailed Description

These functions are based on "half spaces" rather than surfaces. For example, a vertex "intercepts" a sphere if it inside it rather than only if on the boundary. Likewise, a vertex intercepts a plane if it is "above" it (in the direction of the plane normal) rather than on it.

The implicit argument to all these functions is a vertex. For example, cluPlaneIntercept() does not explicitly state an input argument so it implies distance to a vertex.


Function Documentation

GLboolean cluConeIntersect const CLUcone cone,
const CLvertex *  vertex
 

Todo:
get Jim to check this against his xlod code

check again since move to half_angle

Definition at line 626 of file clumaths.c.

References cluNormalDifference(), cluNormalDotProduct(), cluNormalNormalise(), CLUcone::direction, CLUcone::half_angle, and CLUcone::origin.

bool cluRayIntersectSphere float *  t,
const CLUray ray,
const CLUsphere sphere
 

t pointer to a float into which the time value is written, the time value is the distance along the ray direction vector at which the intersection takes place.

ray The ray to test.

sphere The sphere to test.

Returns:
True, if the ray intersects the sphere, false otherwise.
Note:
Adapted from Geometric Tools for Computer Graphics - Schneider & Eberly, pg. 502

Definition at line 755 of file clumaths.c.

References cluNormalDifference(), cluNormalDotProduct(), CLUray::direction, CLUray::origin, CLUsphere::origin, and CLUsphere::radius.

bool cluRayIntersectTriangle CLvertex *  result,
const CLUray ray,
const CLvertex *  v0,
const CLvertex *  v1,
const CLvertex *  v2
 

result A vertex (x, y, z) where the result is stored, the result is of the form (t, u, v).

ray The ray to test.

v0 The first vertex of the triangle to test.

v1 The second vertex of the triangle to test.

v2 The third vertex of the triangle to test.

Returns:
True, if the ray and triangle intersect, otherwise false.
Note:
Adapted from http://www.acm.org/jgt/papers/MollerTrumbore97/code.html

Definition at line 804 of file clumaths.c.

References cluNormalCrossProduct(), cluNormalDifference(), cluNormalDotProduct(), CLUray::direction, and CLUray::origin.

CLUray* cluSetRayOriginDestination CLUray ray,
CLvertex *  origin,
CLvertex *  destination
 

Parameters:
ray The ray to set.
origin The origin of the ray.
destination The destination of the ray.
Returns:
A pointer to the ray.
Warning:
Does not normalise ray. May have length != 1.

Definition at line 952 of file clumaths.c.

References cluNormalDifference(), cluSetVertex(), CLUray::direction, and CLUray::origin.

CLvertex* cluSetVertexRayT CLvertex *  vf,
const CLUray ray,
float  t
 

Parameters:
vf A pointer to the vertex to set.
ray The ray on which the vertex is positioned.
t The position along the ray at which the vertex is positioned.
Returns:
A pointer to the vertex.
Todo:
Move to CLU

Definition at line 920 of file clumaths.c.

References cluNormalScale(), cluVertexAdd(), CLUray::direction, and CLUray::origin.

GLboolean cluSphereIntersectSphere const CLUsphere sphere0,
const CLUsphere sphere1
 

Todo:
fix this obvious error UR.... this looks really, really wrong

Definition at line 561 of file clumaths.c.

References cluSphereDistanceSphere().


Generated on Thu Dec 27 13:53:42 2007 for CLU by  doxygen 1.4.6