PlayRho  2.0.0
An interactive physics engine & library.
playrho::d2::part::DynamicRectangle< W, H, V > Class Template Reference

Dynamic rectangle. More...

#include <playrho/d2/part/Compositor.hpp>

Public Member Functions

 DynamicRectangle (Length width, Length height, const Length2 &offset=Length2{})
 Initializing constructor.
 
DistanceProxy GetChild (ChildCounter index) const
 Gets the "child" shape for the given shape configuration.
 
ChildCounter GetChildCount () const noexcept
 Gets the child count. More...
 
Length2 GetDimensions () const noexcept
 Gets the dimensions of this rectangle. More...
 
MassData GetMassData (NonNegative< AreaDensity > density) const noexcept
 Gets the mass data for the geometry.
 
const std::array< UnitVec, 4u > & GetNormals () const noexcept
 Gets this rectangle's normals. More...
 
Length2 GetOffset () const noexcept
 Gets the x and y offset of this rectangle. More...
 
constexpr NonNegative< LengthGetVertexRadius () const noexcept
 Gets the vertex radius.
 
const std::array< Length2, 4u > & GetVertices () const noexcept
 Gets this rectangle's vertices. More...
 
void Scale (const Vec2 &value)
 Scales the vertices of this geometry.
 
void SetDimensions (const Length2 &val)
 Sets the dimensions of this rectangle. More...
 
void SetOffset (const Length2 &val)
 Sets the x and y offset of this rectangle. More...
 
void SetVertexRadius (ChildCounter, NonNegative< Length > value)
 Sets the vertex radius for the specified child to the given value. More...
 
void Translate (const Length2 &value)
 Translates the vertices of this geometry.
 

Detailed Description

template<int W = 1, int H = 1, int V = 2>
class playrho::d2::part::DynamicRectangle< W, H, V >

Dynamic rectangle.

Provides a rectangular runtime-time configurable class implementation of the geometry policy of the Compositor host class template. Unlike the StaticRectangle, this class can have width, height, vertex-radius, and offset set at runtime.

Note
This class is not intended for standalone use.
// Here's an example use of this class for a 3m-wide by 2m-high rectangular part...
auto comp = Compositor<GeometryIs<DynamicRectangle<3, 2>>>{};
See also
StaticRectangle, Compositor.

Member Function Documentation

◆ GetChildCount()

template<int W = 1, int H = 1, int V = 2>
ChildCounter playrho::d2::part::DynamicRectangle< W, H, V >::GetChildCount ( ) const
inlinenoexcept

Gets the child count.

See also
GetChild.

◆ GetDimensions()

template<int W = 1, int H = 1, int V = 2>
Length2 playrho::d2::part::DynamicRectangle< W, H, V >::GetDimensions ( ) const
inlinenoexcept

◆ GetNormals()

template<int W = 1, int H = 1, int V = 2>
const std::array<UnitVec, 4u>& playrho::d2::part::DynamicRectangle< W, H, V >::GetNormals ( ) const
inlinenoexcept

Gets this rectangle's normals.

See also
GetVertices.

Referenced by playrho::d2::part::DynamicRectangle< W, H, V >::GetChild().

◆ GetOffset()

template<int W = 1, int H = 1, int V = 2>
Length2 playrho::d2::part::DynamicRectangle< W, H, V >::GetOffset ( ) const
inlinenoexcept

◆ GetVertices()

template<int W = 1, int H = 1, int V = 2>
const std::array<Length2, 4u>& playrho::d2::part::DynamicRectangle< W, H, V >::GetVertices ( ) const
inlinenoexcept

◆ SetDimensions()

template<int W = 1, int H = 1, int V = 2>
void playrho::d2::part::DynamicRectangle< W, H, V >::SetDimensions ( const Length2 val)
inline

Sets the dimensions of this rectangle.

See also
GetDimensions.

Referenced by playrho::d2::part::DynamicRectangle< W, H, V >::Scale().

◆ SetOffset()

template<int W = 1, int H = 1, int V = 2>
void playrho::d2::part::DynamicRectangle< W, H, V >::SetOffset ( const Length2 val)
inline

Sets the x and y offset of this rectangle.

See also
GetOffset.

Referenced by playrho::d2::part::DynamicRectangle< W, H, V >::Translate().

◆ SetVertexRadius()

template<int W = 1, int H = 1, int V = 2>
void playrho::d2::part::DynamicRectangle< W, H, V >::SetVertexRadius ( ChildCounter  ,
NonNegative< Length value 
)
inline

Sets the vertex radius for the specified child to the given value.

Note
This class does support changing the vertex radius.

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