Distance Proxy.
More...
#include <DistanceProxy.hpp>
Distance Proxy.
A distance proxy aggragates a convex set of vertices and a vertexRadius of those vertices. This can be visualized as a convex N-gon with rounded corners. It's meant to represent any single portion of a shape identified by its child-index. These are used by the GJK algorithm: "a method for determining the minimium distance between two convex sets".
- Note
- This data structure is 24-bytes.
- See also
- https://en.wikipedia.org/wiki/Gilbert%2DJohnson%2DKeerthi_distance_algorithm
◆ size_type
Size type.
Must be big enough to hold max posible count of vertices.
◆ DistanceProxy() [1/3]
box2d::DistanceProxy::DistanceProxy |
( |
| ) |
|
|
default |
◆ DistanceProxy() [2/3]
constexpr box2d::DistanceProxy::DistanceProxy |
( |
const DistanceProxy & |
copy | ) |
|
|
inlinenoexcept |
◆ DistanceProxy() [3/3]
Initializing constructor.
Constructs a distance proxy for n-point shape (like a polygon).
- Parameters
-
vertexRadius | Radius of the given vertices. |
count | Count of elements of the vertices and normals arrays. |
vertices | Collection of vertices of the shape (relative to the shape's origin). |
normals | Collection of normals of the shape. |
- Note
- The vertices collection must have more than zero elements and no more than
MaxShapeVertices
elements.
- Warning
- Behavior is undefined if the vertices collection has less than one element or more than
MaxShapeVertices
elements.
◆ GetNormal()
auto box2d::DistanceProxy::GetNormal |
( |
size_type |
index | ) |
const |
|
inlinenoexcept |
◆ GetNormals()
Span<const UnitVec2> box2d::DistanceProxy::GetNormals |
( |
| ) |
const |
|
inlinenoexcept |
◆ GetVertex()
auto box2d::DistanceProxy::GetVertex |
( |
size_type |
index | ) |
const |
|
inlinenoexcept |
Gets a vertex by index.
- Parameters
-
index | Index value less than the count of vertices represented by this proxy. |
- Note
- Behavior is undefined if the index given is not less than the count of vertices represented by this proxy.
-
Behavior is undefined if InvalidIndex is given as the index value.
- Returns
- 2D vector position (relative to the shape's origin) at the given index.
- See also
- Distance.
◆ GetVertexCount()
auto box2d::DistanceProxy::GetVertexCount |
( |
| ) |
const |
|
inlinenoexcept |
Gets the vertex count.
This is the count of valid vertex elements that this object provides.
- Returns
- Value between 0 and
MaxShapeVertices
.
- Note
- This only returns 0 if this proxy was default constructed.
◆ GetVertexRadius()
auto box2d::DistanceProxy::GetVertexRadius |
( |
| ) |
const |
|
inlinenoexcept |
Gets the vertexRadius of the vertices of the associated shape.
- Returns
- Non-negative distance.
◆ GetVertices()
Span<const Length2D> box2d::DistanceProxy::GetVertices |
( |
| ) |
const |
|
inlinenoexcept |
◆ InvalidIndex
The documentation for this class was generated from the following file: