Drake
Drake C++ Documentation
Capsule Class Referencefinal

Detailed Description

Definition of a capsule.

The capsule can be thought of as a cylinder with spherical caps attached. The capsule's length refers to the length of the cylindrical region, and the radius applies to both the cylinder and spherical caps. A capsule with zero length is a sphere of the given radius. And a capsule with zero radius is a line segment with the given length. The capsule is defined in its canonical frame C, centered on the frame origin and with the length of the capsule parallel with the frame's z-axis.

#include <drake/geometry/shape_specification.h>

Public Member Functions

 Capsule (double radius, double length)
 Constructs a capsule with the given radius and length. More...
 
 Capsule (const Vector2< double > &measures)
 Constructs a capsule with a vector of measures: radius and length. More...
 
 ~Capsule () final
 
double radius () const
 
double length () const
 
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 Capsule (const Capsule &)=default
 
Capsuleoperator= (const Capsule &)=default
 
 Capsule (Capsule &&)=default
 
Capsuleoperator= (Capsule &&)=default
 
- Public Member Functions inherited from Shape
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...
 
template<typename ReturnType = void, typename Visitor >
decltype(auto) Visit (Visitor &&visitor) const
 Calls the given visitor function with *this as the sole argument, but with *this downcast to be the shape's concrete subclass. More...
 

Additional Inherited Members

- Protected Types inherited from Shape
using VariantShapeConstPtr = std::variant< const Box *, const Capsule *, const Convex *, const Cylinder *, const Ellipsoid *, const HalfSpace *, const Mesh *, const MeshcatCone *, const Sphere * >
 (Internal use only) All concrete subclasses, as const pointers. More...
 
- Protected Member Functions inherited from Shape
 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...
 

Constructor & Destructor Documentation

◆ Capsule() [1/4]

Capsule ( const Capsule )
default

◆ Capsule() [2/4]

Capsule ( Capsule &&  )
default

◆ Capsule() [3/4]

Capsule ( double  radius,
double  length 
)

Constructs a capsule with the given radius and length.

Exceptions
std::exceptionif radius or length are not strictly positive.

◆ Capsule() [4/4]

Capsule ( const Vector2< double > &  measures)
explicit

Constructs a capsule with a vector of measures: radius and length.

Exceptions
std::exceptionif the measures are not strictly positive.

◆ ~Capsule()

~Capsule ( )
final

Member Function Documentation

◆ length()

double length ( ) const

◆ operator=() [1/2]

Capsule& operator= ( Capsule &&  )
default

◆ operator=() [2/2]

Capsule& operator= ( const Capsule )
default

◆ radius()

double radius ( ) const

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