Drake
Drake C++ Documentation
Box Class Referencefinal

Detailed Description

Definition of a box.

The box is centered on the origin of its canonical frame with its dimensions aligned with the frame's axes. The size of the box is given by three sizes.

#include <drake/geometry/shape_specification.h>

Public Member Functions

 Box (double width, double depth, double height)
 Constructs a box with the given width, depth, and height, which specify the box's dimension along the canonical x-, y-, and z-axes, respectively. More...
 
 Box (const Vector3< double > &measures)
 Constructs a box with a vector of measures: width, depth, and height – the box's dimensions along the canonical x-, y-, and z-axes, respectively. More...
 
 ~Box () final
 
double width () const
 Returns the box's dimension along the x axis. More...
 
double depth () const
 Returns the box's dimension along the y axis. More...
 
double height () const
 Returns the box's dimension along the z axis. More...
 
const Vector3< double > & size () const
 Returns the box's dimensions. More...
 
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 Box (const Box &)=default
 
Boxoperator= (const Box &)=default
 
 Box (Box &&)=default
 
Boxoperator= (Box &&)=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...
 

Static Public Member Functions

static Box MakeCube (double edge_size)
 Constructs a cube with the given edge_size for its width, depth, and height. 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

◆ Box() [1/4]

Box ( const Box )
default

◆ Box() [2/4]

Box ( Box &&  )
default

◆ Box() [3/4]

Box ( double  width,
double  depth,
double  height 
)

Constructs a box with the given width, depth, and height, which specify the box's dimension along the canonical x-, y-, and z-axes, respectively.

Exceptions
std::exceptionif width, depth or height are not strictly positive.

◆ Box() [4/4]

Box ( const Vector3< double > &  measures)
explicit

Constructs a box with a vector of measures: width, depth, and height – the box's dimensions along the canonical x-, y-, and z-axes, respectively.

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

◆ ~Box()

~Box ( )
final

Member Function Documentation

◆ depth()

double depth ( ) const

Returns the box's dimension along the y axis.

◆ height()

double height ( ) const

Returns the box's dimension along the z axis.

◆ MakeCube()

static Box MakeCube ( double  edge_size)
static

Constructs a cube with the given edge_size for its width, depth, and height.

◆ operator=() [1/2]

Box& operator= ( Box &&  )
default

◆ operator=() [2/2]

Box& operator= ( const Box )
default

◆ size()

const Vector3<double>& size ( ) const

Returns the box's dimensions.

◆ width()

double width ( ) const

Returns the box's dimension along the x axis.


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