Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
trax::Shape Struct Referenceabstract

A Shape is a collection of Geoms. More...

#include <C:/Trend/Development/Trax3/Code/trax/rigid/Shape.h>

Inheritance diagram for trax::Shape:

Public Member Functions

virtual void SetName (const char *name) noexcept=0
 Sets the name of the Shape.
virtual const char * GetName () const noexcept=0
virtual void SetFrame (const spat::Frame< Length, One > &frame) noexcept=0
 Sets position and orientation (pose) in global coordinates.
virtual void GetFrame (spat::Frame< Length, One > &frame) const noexcept=0
 Gets the pose in global coordinates.
virtual spat::Box< LengthGetExtent () const noexcept=0
 Gets the minimum axis aligned box that includes the the Geoms completely.
virtual std::unique_ptr< GeomRemove (int idx)=0
 Removes the Geom with index idx from the Shape.
virtual void Clear () noexcept=0
 Remove all Geoms from the Shape.
virtual int Count () const =0
virtual GeomGet (int idx=0) const =0
virtual int Attach (std::unique_ptr< Geom > pGeom)=0
 Attach a Geom to the Shape.
virtual int Attach (std::vector< std::unique_ptr< Geom > > &geoms)=0

Detailed Description

A Shape is a collection of Geoms.

A Shape forms a more complex geometrical object by combining multiple Geoms into a single entity.

See also
trax::Geom for simple shapes.

Member Function Documentation

◆ Attach() [1/2]

virtual int trax::Shape::Attach ( std::unique_ptr< Geom > pGeom)
pure virtual

Attach a Geom to the Shape.

This will be used for collision testing. The Geom carries a frame of reference to specify it's pose relative to the Shape's pose.

Parameters
pGeomA Geom to be attached to the Shape.
Returns
The zero based index of the first Geom attached; the consecutive geoms will be assigned indexes from that in increasing order.

Implemented in trax::Gestalt.

◆ Attach() [2/2]

virtual int trax::Shape::Attach ( std::vector< std::unique_ptr< Geom > > & geoms)
pure virtual
Parameters
geomsA list of Geoms to be attached to the Shape.
Returns
The zero based index of the first Geom attached; the consecutive geoms will be assigned indexes from that in increasing order.

Implemented in trax::Gestalt.

◆ Clear()

virtual void trax::Shape::Clear ( )
pure virtualnoexcept

Remove all Geoms from the Shape.

This might not be a good idea for objects like bogies that have added some Geoms internally.

◆ Count()

virtual int trax::Shape::Count ( ) const
pure virtual
Returns
the number of Geoms attached to this Shape.

◆ Get()

virtual Geom & trax::Shape::Get ( int idx = 0) const
pure virtual
Parameters
idxzero based index of the Geom.
Returns
a reference to the Geom at index idx.

◆ GetFrame()

virtual void trax::Shape::GetFrame ( spat::Frame< Length, One > & frame) const
pure virtualnoexcept

Gets the pose in global coordinates.

Implemented in trax::Gestalt.

◆ GetName()

virtual const char * trax::Shape::GetName ( ) const
pure virtualnoexcept
Returns
The name of the Shape.

Implemented in trax::Gestalt.

◆ Remove()

virtual std::unique_ptr< Geom > trax::Shape::Remove ( int idx)
pure virtual

Removes the Geom with index idx from the Shape.

This call invalidates all the Geom's indexes >= idx.

Returns
a pointer to the removed Geom.
Exceptions
std::out_of_rangewhen idx is outside [0,Clear()[

◆ SetFrame()

virtual void trax::Shape::SetFrame ( const spat::Frame< Length, One > & frame)
pure virtualnoexcept

Sets position and orientation (pose) in global coordinates.

This will set the position and orientation of the Shape in global simulation space.

Parameters
frameFrame of reference. Must be orthonormal.

Implemented in trax::Gestalt.

◆ SetName()

virtual void trax::Shape::SetName ( const char * name)
pure virtualnoexcept

Sets the name of the Shape.

This is for debug purposes; the string is not copied, only the pointer is stored.

Implemented in trax::Gestalt.


The documentation for this struct was generated from the following file:
  • C:/Trend/Development/Trax3/Code/trax/rigid/Shape.h