Drake
Drake C++ Documentation
Shape Class Referenceabstract

Detailed Description

The abstract base class for all shape specifications.

Concrete subclasses exist for specific shapes (e.g., Box, Mesh, etc.).

The Shape class has two key properties:

  • it is cloneable, and
  • it can be "reified" (see ShapeReifier).

Note that the Shape class hierarchy is closed to third-party extensions. All Shape classes must be defined within Drake directly (and in this h/cc file pair in particular).

#include <drake/geometry/shape_specification.h>

Public Member Functions

virtual ~Shape ()
 
void Reify (ShapeReifier *reifier, void *user_data=nullptr) const
 Causes this description to be reified in the given reifier. More...
 
std::unique_ptr< ShapeClone () const
 Creates a unique copy of this shape. More...
 
std::string_view type_name () const
 Returns the (unqualified) type name of this Shape, e.g., "Box". More...
 
std::string to_string () const
 Returns a string representation of this shape. More...
 

Protected Member Functions

 Shape ()
 (Internal use only) Constructor for use by derived classes. More...
 
 Shape (const Shape &)=default
 (Internal use only) For derived classes. More...
 
Shapeoperator= (const Shape &)=default
 (Internal use only) For derived classes. More...
 
 Shape (Shape &&)=default
 (Internal use only) For derived classes. More...
 
Shapeoperator= (Shape &&)=default
 (Internal use only) For derived classes. More...
 
virtual void DoReify (ShapeReifier *, void *) const =0
 (Internal use only) NVI for Reify(). More...
 
virtual std::unique_ptr< ShapeDoClone () const =0
 (Internal use only) NVI for Clone(). More...
 
virtual std::string_view do_type_name () const =0
 (Internal use only) NVI for type_name(). More...
 
virtual std::string do_to_string () const =0
 (Internal use only) NVI for to_string(). More...
 

Constructor & Destructor Documentation

◆ ~Shape()

virtual ~Shape ( )
virtual

◆ Shape() [1/3]

Shape ( )
protected

(Internal use only) Constructor for use by derived classes.

All subclasses of Shape must be marked final.

◆ Shape() [2/3]

Shape ( const Shape )
protecteddefault

(Internal use only) For derived classes.

◆ Shape() [3/3]

Shape ( Shape &&  )
protecteddefault

(Internal use only) For derived classes.

Member Function Documentation

◆ Clone()

std::unique_ptr<Shape> Clone ( ) const

Creates a unique copy of this shape.

◆ do_to_string()

virtual std::string do_to_string ( ) const
protectedpure virtual

(Internal use only) NVI for to_string().

◆ do_type_name()

virtual std::string_view do_type_name ( ) const
protectedpure virtual

(Internal use only) NVI for type_name().

◆ DoClone()

virtual std::unique_ptr<Shape> DoClone ( ) const
protectedpure virtual

(Internal use only) NVI for Clone().

◆ DoReify()

virtual void DoReify ( ShapeReifier ,
void *   
) const
protectedpure virtual

(Internal use only) NVI for Reify().

◆ operator=() [1/2]

Shape& operator= ( const Shape )
protecteddefault

(Internal use only) For derived classes.

◆ operator=() [2/2]

Shape& operator= ( Shape &&  )
protecteddefault

(Internal use only) For derived classes.

◆ Reify()

void Reify ( ShapeReifier reifier,
void *  user_data = nullptr 
) const

Causes this description to be reified in the given reifier.

Each concrete subclass must invoke the single, matching method on the reifier. Provides optional user-data (cast as a void*) for the reifier to consume.

◆ to_string()

std::string to_string ( ) const

Returns a string representation of this shape.

◆ type_name()

std::string_view type_name ( ) const

Returns the (unqualified) type name of this Shape, e.g., "Box".


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