Support Forum       G3D Web Page     
Classes | Public Member Functions | Static Public Member Functions | Static Protected 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.

Classes

class  Type
 

Public Member Functions

virtual ~Shape ()
 
virtual float area () const =0
 Surface area of the outside of this object. More...
 
virtual CoordinateFrameaxes ()
 
virtual AABox boundingAABox () const =0
 Bounding axis aligned box of this object. More...
 
virtual Sphere boundingSphere () const =0
 Bounding sphere of this object. More...
 
virtual Boxbox ()
 
virtual const Boxbox () const
 
virtual Capsulecapsule ()
 
virtual const Capsulecapsule () const
 
virtual Vector3 center () const =0
 Center of mass for this object. More...
 
virtual Cylindercylinder ()
 
virtual const Cylindercylinder () const
 
virtual void getRandomSurfacePoint (Point3 &P, Vector3 &N=Vector3::ignore, Random &rnd=Random::common()) const =0
 A point selected uniformly at random with respect to the surface area of this object. More...
 
virtual const Array< int > & indexArray () const
 
virtual Planeplane ()
 
virtual const Planeplane () const
 
virtual Vector3point ()
 
virtual const Vector3point () const
 
virtual Point3 randomInteriorPoint (Random &rnd=Random::common()) const =0
 A point selected uniformly at random with respect to the volume of this object. More...
 
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. More...
 

Static Public Member Functions

static String typeToString (Type t)
 

Static Protected Member Functions

template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 

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

Constructor & Destructor Documentation

◆ ~Shape()

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

Member Function Documentation

◆ area()

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

◆ axes()

virtual CoordinateFrame& G3D::Shape::axes ( )
inlinevirtual

Reimplemented in G3D::AxesShape.

◆ boundingAABox()

virtual AABox G3D::Shape::boundingAABox ( ) const
pure virtual

◆ boundingSphere()

virtual Sphere G3D::Shape::boundingSphere ( ) const
pure virtual

◆ box() [1/2]

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

Reimplemented in G3D::BoxShape.

◆ box() [2/2]

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

Reimplemented in G3D::BoxShape.

◆ capsule() [1/2]

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

Reimplemented in G3D::CapsuleShape.

◆ capsule() [2/2]

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

Reimplemented in G3D::CapsuleShape.

◆ center()

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

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ cylinder() [1/2]

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

Reimplemented in G3D::CylinderShape.

◆ cylinder() [2/2]

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

Reimplemented in G3D::CylinderShape.

◆ getRandomSurfacePoint()

virtual void G3D::Shape::getRandomSurfacePoint ( Point3 P,
Vector3 N = Vector3::ignore,
Random rnd = Random::common() 
) 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.

◆ indexArray()

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

Reimplemented in G3D::MeshShape.

◆ plane() [1/2]

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

Reimplemented in G3D::PlaneShape.

◆ plane() [2/2]

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

Reimplemented in G3D::PlaneShape.

◆ point() [1/2]

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

Reimplemented in G3D::PointShape.

◆ point() [2/2]

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

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

◆ randomInteriorPoint()

virtual Point3 G3D::Shape::randomInteriorPoint ( Random rnd = Random::common()) 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.

◆ ray() [1/2]

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

Reimplemented in G3D::RayShape.

◆ ray() [2/2]

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

Reimplemented in G3D::RayShape.

◆ render()

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

◆ sphere() [1/2]

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

Reimplemented in G3D::SphereShape.

◆ sphere() [2/2]

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

Reimplemented in G3D::SphereShape.

◆ triangle() [1/2]

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

Reimplemented in G3D::TriangleShape.

◆ triangle() [2/2]

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

Reimplemented in G3D::TriangleShape.

◆ type()

virtual Type G3D::Shape::type ( ) const
pure virtual

◆ typeToString()

static String G3D::Shape::typeToString ( Type  t)
static

◆ vertexArray()

virtual const Array<Vector3>& G3D::Shape::vertexArray ( ) const
inlinevirtual

Reimplemented in G3D::MeshShape.

◆ volume()

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

documentation generated on Wed Nov 24 2021 08:02:00 using doxygen 1.8.15