playrho::d2::DynamicTree::LeafData Struct Reference

Leaf data of a tree node. More...

#include <DynamicTree.hpp>

Public Attributes

Bodybody
 Cached pointer to associated body. More...
 
Fixturefixture
 Pointer to associated Fixture. More...
 
ChildCounter childIndex
 Child index of related Shape. More...
 

Related Functions

(Note that these are not member functions.)

PLAYRHO_CONSTEXPR bool operator== (const DynamicTree::LeafData &lhs, const DynamicTree::LeafData &rhs) noexcept
 Equality operator. More...
 
PLAYRHO_CONSTEXPR bool operator!= (const DynamicTree::LeafData &lhs, const DynamicTree::LeafData &rhs) noexcept
 Inequality operator. More...
 

Detailed Description

Leaf data of a tree node.

This is the leaf node specific data for a DynamicTree::TreeNode. It's data that only pertains to leaf nodes.

Note
This class is used in the DynamicTree::VariantData union within a DynamicTree::TreeNode. This has ramifications on this class's data contents and size.

Definition at line 298 of file DynamicTree.hpp.

Friends And Related Function Documentation

◆ operator==()

PLAYRHO_CONSTEXPR bool operator== ( const DynamicTree::LeafData lhs,
const DynamicTree::LeafData rhs 
)
related

Equality operator.

Definition at line 331 of file DynamicTree.hpp.

◆ operator!=()

PLAYRHO_CONSTEXPR bool operator!= ( const DynamicTree::LeafData lhs,
const DynamicTree::LeafData rhs 
)
related

Inequality operator.

Definition at line 339 of file DynamicTree.hpp.

Member Data Documentation

◆ body

Body* playrho::d2::DynamicTree::LeafData::body

Cached pointer to associated body.

Note
This field serves merely to potentially avoid the lookup of the body through the fixture. It may or may not be worth the extra 8-bytes or so required for it.
On 64-bit architectures, this is an 8-byte sized field. As an 8-byte field it conceptually identifies 2^64 separate bodies within a world. As a practical matter however, even a 4-byte index which could identify 2^32 bodies, is still larger than is usable. This suggests that space could be saved by using indexes into arrays of bodies instead of direct pointers to memory.

Definition at line 315 of file DynamicTree.hpp.

◆ fixture

Fixture* playrho::d2::DynamicTree::LeafData::fixture

Pointer to associated Fixture.

Note
On 64-bit architectures, this is an 8-byte sized field. As an 8-byte field it conceptually identifies 2^64 separate fixtures within a world. As a practical matter however, even a 4-byte index which could identify 2^32 fixtures, is still larger than is usable. This suggests that space could be saved by using indexes into arrays of fixtures instead of direct pointers to memory.

Definition at line 323 of file DynamicTree.hpp.

◆ childIndex

ChildCounter playrho::d2::DynamicTree::LeafData::childIndex

Child index of related Shape.

Definition at line 326 of file DynamicTree.hpp.


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