Main Page | Class Hierarchy | Class List | Class Members

RaySphere Class Reference

Inheritance diagram for RaySphere:

RayShape List of all members.

Public Member Functions

 RaySphere (void)
int read (FILE *fp, int *materialIndex)
void write (int indent, FILE *fp=stdout)
double intersect (Ray3D ray, struct RayIntersectionInfo &iInfo, double mx=-1)
BoundingBox3D setBoundingBox (void)
void setUpOpenGL (int cplx, int setCallList)
int drawOpenGL (int materialIndex)

Public Attributes

Point3D center
double radius
RayMaterialmaterial

Detailed Description

This class describes a sphere, and is represented by its center and radius.


Constructor & Destructor Documentation

RaySphere::RaySphere void   ) 
 

The default constructore


Member Function Documentation

int RaySphere::drawOpenGL int  materialIndex  )  [virtual]
 

This method calls the necessary OpenGL commands to render the primitive.

Implements RayShape.

double RaySphere::intersect Ray3D  ray,
struct RayIntersectionInfo iInfo,
double  mx = -1
[virtual]
 

This method computes the intersection of the shape with the ray. If the ray hits the shape and either mx is less than zero or the intersection occurs at a distance less than t along the ray the intersection information in iInfo is set and a value greater than 0 is returned. Otherwise, -1 is returned. (This is useful for shadow testing when you may want to ignore hits beyond a certain distance). Either way the isectCounter is incremented by one.

Implements RayShape.

int RaySphere::read FILE *  fp,
int *  materialIndex
 

This method reads in a RaySphere from a .ray file. A pointer to the material associated to the triangle is set.

BoundingBox3D RaySphere::setBoundingBox void   )  [virtual]
 

This method sets and returns a bounding box containing the shape.

Implements RayShape.

void RaySphere::setUpOpenGL int  cplx,
int  setCallList
[virtual]
 

This method sets up all the stuff that's necessary prior to OpenGL rendering. The value cplx represents the desired resolution of tessalation for objects such as spheres, cylinders, etc..

Implements RayShape.

void RaySphere::write int  indent,
FILE *  fp = stdout
[virtual]
 

This method writes the RayShape out to a .ray file, indenting the output by the specified amount. If no file is specified, the information gets written to stdout.

Implements RayShape.


Member Data Documentation

Point3D RaySphere::center
 

The center of the sphere

class RayMaterial* RaySphere::material
 

The material associated with the sphere

double RaySphere::radius
 

The radius of the sphere


Generated on Wed Feb 22 15:44:23 2006 for Assignment 2 by  doxygen 1.4.1