Shape Class Reference

Abstract representation of a shape in 3-space. More...

#include <Shape.h>

Inheritance diagram for Shape:

Intersectable SSEAligned Camera Transformable ThinLensCamera Blob Implicit InstancedShape Mesh PointShape ShapeSet Triangle

List of all members.

Lazy evaluation of SurfacePoint information

class InstancedShape
virtual void initSurfacePoint (SurfacePoint &pt) const
 Initializes the given SurfacePoint which is assumed to lie on the surface of this Shape; fills in the point's UV coords, normal, and Material properties (.
virtual void _getUV (SurfacePoint &pt) const =0
virtual void _getGeometricNormal (SurfacePoint &pt) const =0
virtual real_t _getSurfaceArea ()

Public Member Functions

Constructors
 Shape (Material *material=NULL)
virtual ~Shape ()
Initialization
virtual void init ()
 Initializes this Shape for fast intersection testing.
Main usage interface
virtual bool hasNormal () const
virtual void preview ()
 Displays a crude OpenGL preview of this shape.
Sampling functionality
virtual void getRandomPoint (SurfacePoint &pt)
virtual void getPoint (SurfacePoint &pt, const UV &uv)
virtual Point3 getPosition (const UV &uv)
virtual real_t getSurfaceArea ()
Accessors / Mutators
virtual AABB getAABB () const
void setMaterial (Material *material)
MaterialgetMaterial ()
virtual bool isTransformable () const

Protected Attributes

AABB m_aabb
 World-space AABB.
Materialm_material
 Material describing reflectance properties over this shape's surface.
real_t m_surfaceArea
 World-space surface area of this shape.


Detailed Description

Abstract representation of a shape in 3-space.

Author:
Travis Fischer (fisch0920@gmail.com)

Matthew Jacobs (jacobs.mh@gmail.com)

Date:
Fall 2008

Definition at line 24 of file Shape.h.


Constructor & Destructor Documentation

Shape::Shape ( Material material = NULL  )  [inline]

Definition at line 29 of file Shape.h.

virtual Shape::~Shape (  )  [inline, virtual]

Definition at line 33 of file Shape.h.


Member Function Documentation

void Shape::init (  )  [virtual]

Initializes this Shape for fast intersection testing.

Note:
default implementation ensures this shape has been given a valid material

must be called before getIntersection or intersects

Reimplemented from Intersectable.

Reimplemented in Blob, Implicit, InstancedShape, Mesh, Plane, PointShape, ShapeSet, Transformable, and Triangle.

Definition at line 28 of file Shape.cpp.

bool Shape::hasNormal (  )  const [virtual]

Returns:
whether or not this Shape supports the concept of a geometric surface normal defined over its surface
Note:
default implementation returns true

Reimplemented in InstancedShape, and PointShape.

Definition at line 40 of file Shape.cpp.

void Shape::preview (  )  [virtual]

Displays a crude OpenGL preview of this shape.

Note:
default implementation calls preview on this shape's material

Reimplemented in Blob, Cone, Cube, Cylinder, InstancedShape, Mesh, Plane, PointShape, ShapeSet, Sphere, Transformable, and Triangle.

Definition at line 35 of file Shape.cpp.

void Shape::getRandomPoint ( SurfacePoint pt  )  [virtual]

Returns:
a point chosen uniformly random over the surface of this shape in 'pt'
Note:
the probability density of selecting this point is assumed to be (1.0 / getSurfaceArea())

default implementation returns origin because not all shapes support this functionality

Reimplemented in InstancedShape, Sphere, and Triangle.

Definition at line 44 of file Shape.cpp.

void Shape::getPoint ( SurfacePoint pt,
const UV uv 
) [virtual]

Returns:
the point on the surface of this shape corresponding to the given UV coordinates in 'pt'
Note:
default implementation returns origin because not all shapes support this functionality

Reimplemented in Mesh.

Definition at line 51 of file Shape.cpp.

Point3 Shape::getPosition ( const UV uv  )  [virtual]

Returns:
the point on the surface of this shape corresponding to the given UV coordinates
Note:
default implementation returns origin because not all shapes support this functionality

Reimplemented in Camera, InstancedShape, Mesh, Plane, Sphere, Transformable, and Triangle.

Definition at line 65 of file Shape.cpp.

real_t Shape::getSurfaceArea (  )  [virtual]

Returns:
the total surface area of this shape
Note:
default implementation returns m_surfaceArea, which is assumed to be calculated at shape initialization

Reimplemented in PointShape.

Definition at line 69 of file Shape.cpp.

virtual AABB Shape::getAABB (  )  const [inline, virtual]

Implements Intersectable.

Reimplemented in Blob.

Definition at line 119 of file Shape.h.

void Shape::setMaterial ( Material material  )  [inline]

Definition at line 123 of file Shape.h.

Material* Shape::getMaterial (  )  [inline]

Definition at line 127 of file Shape.h.

virtual bool Shape::isTransformable (  )  const [inline, virtual]

Returns:
true iff this Shape subclasses Transformable

Reimplemented in Transformable.

Definition at line 134 of file Shape.h.

void Shape::initSurfacePoint ( SurfacePoint pt  )  const [virtual]

Initializes the given SurfacePoint which is assumed to lie on the surface of this Shape; fills in the point's UV coords, normal, and Material properties (.

See also:
Material::initSurfacePoint)

Reimplemented in InstancedShape.

Definition at line 16 of file Shape.cpp.

virtual void Shape::_getUV ( SurfacePoint pt  )  const [protected, pure virtual]

virtual void Shape::_getGeometricNormal ( SurfacePoint pt  )  const [protected, pure virtual]

real_t Shape::_getSurfaceArea (  )  [protected, virtual]

Returns:
the total surface area of this shape
Note:
default implementation returns 0 because not all shapes support this calculation (some are especially hard to compute in world space)

Reimplemented in Cube, InstancedShape, Mesh, Plane, ShapeSet, Sphere, and Triangle.

Definition at line 73 of file Shape.cpp.


Friends And Related Function Documentation

friend class InstancedShape [friend]

Definition at line 164 of file Shape.h.


Member Data Documentation

AABB Shape::m_aabb [protected]

World-space AABB.

Definition at line 170 of file Shape.h.

Material describing reflectance properties over this shape's surface.

Definition at line 173 of file Shape.h.

World-space surface area of this shape.

Definition at line 176 of file Shape.h.


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

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6