Support Forum       Library Source       SourceForge Page       G3D Web Page     
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
G3D::Shape Class Referenceabstract

Base class for debugging shapes that can render themselves. More...

Inherits G3D::ReferenceCountedObject.

Inherited by G3D::ArrowShape, G3D::AxesShape, G3D::BoxShape, G3D::CapsuleShape, G3D::CylinderShape, G3D::MeshShape, G3D::PlaneShape, G3D::PointShape, G3D::RayShape, G3D::SphereShape, and G3D::TriangleShape.

Public Types

typedef shared_ptr< ShapeRef
 
enum  Type {
  NONE = 0,
  MESH = 1,
  BOX,
  CYLINDER,
  SPHERE,
  RAY,
  ARROW,
  CAPSULE,
  PLANE,
  AXES,
  POINT,
  TRIANGLE
}
 

Public Member Functions

virtual ~Shape ()
 
virtual float area () const =0
 Surface area of the outside of this object.
 
virtual CoordinateFrameaxes ()
 
virtual AABox boundingAABox () const =0
 Bounding axis aligned box of this object.
 
virtual Sphere boundingSphere () const =0
 Bounding sphere of this object.
 
virtual Boxbox ()
 
virtual const Boxbox () const
 
virtual Capsulecapsule ()
 
virtual const Capsulecapsule () const
 
virtual Vector3 center () const =0
 Center of mass for this object.
 
virtual Cylindercylinder ()
 
virtual const Cylindercylinder () const
 
virtual void getRandomSurfacePoint (Vector3 &P, Vector3 &N=Vector3::ignore()) const =0
 A point selected uniformly at random with respect to the surface area of this object.
 
virtual const Array< int > & indexArray () const
 
virtual Planeplane ()
 
virtual const Planeplane () const
 
virtual Vector3point ()
 
virtual const Vector3point () const
 
virtual Vector3 randomInteriorPoint () const =0
 A point selected uniformly at random with respect to the volume of this object.
 
virtual Rayray ()
 
virtual const Rayray () const
 
virtual void render (class RenderDevice *rd, const CoordinateFrame &cframe, Color4 solidColor=Color4(.5,.5, 0,.5), Color4 wireColor=Color3::black())=0
 
virtual Spheresphere ()
 
virtual const Spheresphere () const
 
virtual Triangletriangle ()
 
virtual const Triangletriangle () const
 
virtual Type type () const =0
 
virtual const Array< Vector3 > & vertexArray () const
 
virtual float volume () const =0
 Volume of the interior of this object.
 

Static Public Member Functions

static std::string typeToString (Type t)
 

Detailed Description

Base class for debugging shapes that can render themselves.

G3D primitives like Box and Cylinder have no base class so that their implementations are maximally efficient, and have no "render" method because they are lower-level than the rendering API.

The Shape classes provide a parallel set of classes to the G3D primitives that support more functionality.

Mesh shapes are intentionally immutable because they precompute data.

BETA API This API is subject to change in future releases.

See Also
Draw, debugDraw, ArticulatedModel

Member Typedef Documentation

typedef shared_ptr<Shape> G3D::Shape::Ref

Member Enumeration Documentation

Enumerator:
NONE 
MESH 
BOX 
CYLINDER 
SPHERE 
RAY 
ARROW 
CAPSULE 
PLANE 
AXES 
POINT 
TRIANGLE 

Constructor & Destructor Documentation

virtual G3D::Shape::~Shape ( )
inlinevirtual

Member Function Documentation

virtual float G3D::Shape::area ( ) const
pure virtual
virtual CoordinateFrame& G3D::Shape::axes ( )
inlinevirtual

Reimplemented in G3D::AxesShape.

virtual AABox G3D::Shape::boundingAABox ( ) const
pure virtual
virtual Sphere G3D::Shape::boundingSphere ( ) const
pure virtual
virtual Box& G3D::Shape::box ( )
inlinevirtual

Reimplemented in G3D::BoxShape.

virtual const Box& G3D::Shape::box ( ) const
inlinevirtual

Reimplemented in G3D::BoxShape.

virtual Capsule& G3D::Shape::capsule ( )
inlinevirtual

Reimplemented in G3D::CapsuleShape.

virtual const Capsule& G3D::Shape::capsule ( ) const
inlinevirtual

Reimplemented in G3D::CapsuleShape.

virtual Vector3 G3D::Shape::center ( ) const
pure virtual
virtual Cylinder& G3D::Shape::cylinder ( )
inlinevirtual

Reimplemented in G3D::CylinderShape.

virtual const Cylinder& G3D::Shape::cylinder ( ) const
inlinevirtual

Reimplemented in G3D::CylinderShape.

virtual void G3D::Shape::getRandomSurfacePoint ( Vector3 P,
Vector3 N = Vector3::ignore() 
) const
pure virtual

A point selected uniformly at random with respect to the surface area of this object.

Not available on the Plane or Ray, which have infinite extent. The normal has unit length and points out of the surface.

Implemented in G3D::PointShape, G3D::PlaneShape, G3D::CapsuleShape, G3D::SphereShape, G3D::CylinderShape, G3D::AxesShape, G3D::ArrowShape, G3D::RayShape, G3D::TriangleShape, G3D::BoxShape, and G3D::MeshShape.

virtual const Array<int>& G3D::Shape::indexArray ( ) const
inlinevirtual

Reimplemented in G3D::MeshShape.

virtual Plane& G3D::Shape::plane ( )
inlinevirtual

Reimplemented in G3D::PlaneShape.

virtual const Plane& G3D::Shape::plane ( ) const
inlinevirtual

Reimplemented in G3D::PlaneShape.

virtual Vector3& G3D::Shape::point ( )
inlinevirtual

Reimplemented in G3D::PointShape.

virtual const Vector3& G3D::Shape::point ( ) const
inlinevirtual

Reimplemented in G3D::PointShape, and G3D::ArrowShape.

virtual Vector3 G3D::Shape::randomInteriorPoint ( ) const
pure virtual

A point selected uniformly at random with respect to the volume of this object.

Not available on objects with infinite extent.

Implemented in G3D::PointShape, G3D::PlaneShape, G3D::CapsuleShape, G3D::SphereShape, G3D::CylinderShape, G3D::AxesShape, G3D::ArrowShape, G3D::RayShape, G3D::TriangleShape, G3D::BoxShape, and G3D::MeshShape.

virtual Ray& G3D::Shape::ray ( )
inlinevirtual

Reimplemented in G3D::RayShape.

virtual const Ray& G3D::Shape::ray ( ) const
inlinevirtual

Reimplemented in G3D::RayShape.

virtual void G3D::Shape::render ( class RenderDevice rd,
const CoordinateFrame cframe,
Color4  solidColor = Color4(.5,.5, 0,.5),
Color4  wireColor = Color3::black() 
)
pure virtual
virtual Sphere& G3D::Shape::sphere ( )
inlinevirtual

Reimplemented in G3D::SphereShape.

virtual const Sphere& G3D::Shape::sphere ( ) const
inlinevirtual

Reimplemented in G3D::SphereShape.

virtual Triangle& G3D::Shape::triangle ( )
inlinevirtual

Reimplemented in G3D::TriangleShape.

virtual const Triangle& G3D::Shape::triangle ( ) const
inlinevirtual

Reimplemented in G3D::TriangleShape.

virtual Type G3D::Shape::type ( ) const
pure virtual
static std::string G3D::Shape::typeToString ( Type  t)
static
virtual const Array<Vector3>& G3D::Shape::vertexArray ( ) const
inlinevirtual

Reimplemented in G3D::MeshShape.

virtual float G3D::Shape::volume ( ) const
pure virtual

documentation generated on Sat Jan 12 2013 22:49:57 using doxygen 1.8.2