Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csCrystalBall Class Reference

This is an attempt to provide a massdetection of backfaced polygons. More...

#include <crysball.h>

List of all members.

Public Methods

 csCrystalBall ()
 ~csCrystalBall ()
void Build (iPolygonMesh *polyset)
void InsertPolygon (iPolygonMesh *polyset, int idx)
void Transform (const csTransform &t, csVector &indexVector, int useSign, long cookie)

Protected Attributes

csVector vPoints
csVector vTrianglePoints
csTriNode tri [8]


Detailed Description

This is an attempt to provide a massdetection of backfaced polygons.

Observation: Mark 3 distinct points on a sphere. Consider the spherical triangle they form . If all 3 points z-coordinates sign equal then all other points z-coordinate inside the triangle have the same sign.

It works this way: Precompute the normals of a rigid set of polygons. These normals are unit size and therefor mark a point on the unit sphere. If one rotates the polygonset all points on the unit sphere are rotated by the same amount.

To start off, subdivide the sphere into 8 spherical triangles. For every triangle make a list of points (normals) in it. For every triangle then subdivide further into 3 subtriangles and mark the points contained in it. Repeat this process until every triangle contains only one point (normal).

Now to find the backfaced polygons rotate the triangle points on level 0. If a triangles points have all equally signed z-coordinates all polygons belonging to it are either all visible or invisible. If the signs differ then recursively test the subtriangles.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000