Main Page Class Hierarchy Compound List Compound Members Related Pages
BoundingShape Class ReferenceThis is the basis class for all bounding shapes.
More...
#include <BoundingShape.h>
Inheritance diagram for BoundingShape
[legend]Collaboration diagram for BoundingShape:
[legend]List of all members.
Public Methods 
 DECLARE_ABSTRACT_CLASS (BoundingShape,Object3D) 
 BoundingShape () 
virtual  ~BoundingShape () 
virtual bool  hit (Ray *pRay) 
 Test if the ray hits the bounding shape. More...

virtual bool  hit (Ray *pRay,Vector3 &p1,Vector3 &p2) 
 Test if the ray hits the bounding shape. More...

virtual bool  getBounds (Bounds &bounds)const 
 Query for the bounding box of the BoundingShape. More...

Detailed Description
This is the basis class for all bounding shapes.
Other raytracers use any Primitive Object also as a possible Boundingshape (e.g. POVRay). So why is it done differently here? Surly the same approach might fit here, but a explicit BoundingShape type fits better. Let's see why. First a bounding shape ist much more simple than a primitive. A primitive must contain code to accuratly calculate the intersection point. A bounding shape simply has to say "ray might intersect" or "ray definitly misses". So we have a boolean function instead of a 'heavy' point calculation. Also considerations for more than 1 intersection point are simply useless in a bounding shape. Normal and Texture calculations are also obsolete in a bounding shape. So what can we lean about it, use objects that fits it's purpose. This rule especially applies in performance questions. Hey and raytracing is time consuming enough. So let's take the chance an optimize the whole bounding shape stuff. Making a bounding shape what it is, much more simpler (in functionally and computation time) than the primitive "hiding" behind it.
Member Function Documentation
bool BoundingShape::getBounds (

Bounds & bounds ) const [virtual]



Query for the bounding box of the BoundingShape.

Parameters:

bounds

: bounds object containing the bounding area (box) 

Returns:

false  inifite primitive (without bounds) true  noninfite primitive (with bounds)

bool BoundingShape::hit (

Ray * pRay,


Vector3 & p1,


Vector3 & p2 ) [virtual]



Test if the ray hits the bounding shape.
No intersection are calculated. NOTE: Only the miss case must be calculated with certainty. The hit case might also miss the shape (thats not good, but acceptable if calculation is faster) Keep in mind it's nothing you can see, its purely to speedup rendering.
RayArea: 0 <= distance < infinity 
Parameters:

pRay

: the ray the intersection should made with 
p1, p2

: two bounding intersection points 

Returns:

true  intersection may exist (hit) false  no intersection exist (miss)

bool BoundingShape::hit (

Ray * pRay ) [virtual]



Test if the ray hits the bounding shape.
No intersection are calculated. NOTE: Only the miss case must be calculated with certainty. The hit case might also miss the shape (thats not good, but acceptable if calculation is faster) Keep in mind it's nothing you can see, its purely to speedup rendering.
RayArea: 0 <= distance < infinity 
Parameters:

pRay

: the ray the intersection should made with 

Returns:

true  intersection may exist (hit) false  no intersection exist (miss)

The documentation for this class was generated from the following file:
