Distance Proxy.
More...
#include <DistanceProxy.hpp>
Distance Proxy.
A distance proxy aggregates a convex set of vertices and a vertex radius of those vertices. This can be visualized as a convex N-sided polygon with rounded corners. It's meant to represent any single portion of a shape identified by its child-index. These are used by the G.J.K. algorithm: "a method for determining the minimum distance
between two convex sets".
- Note
- This data structure is 24-bytes.
- See also
- https://en.wikipedia.org/wiki/Gilbert%2DJohnson%2DKeerthi_distance_algorithm
◆ DistanceProxy()
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.
-
Behavior is undefined if the vertices are not in counter-clockwise order.
-
Behavior is undefined if the shape defined by the vertices is not convex.
-
Behavior is undefined if the normals aren't normals for adjacent vertices.
-
Behavior is undefined if any normal is not unique.
◆ GetVertex()
auto playrho::d2::DistanceProxy::GetVertex |
( |
VertexCounter |
index | ) |
const |
|
inlinenoexcept |
◆ GetVertexCount()
auto playrho::d2::DistanceProxy::GetVertexCount |
( |
| ) |
const |
|
inlinenoexcept |
◆ GetVertexRadius()
auto playrho::d2::DistanceProxy::GetVertexRadius |
( |
| ) |
const |
|
inlinenoexcept |
◆ ComputeAABB() [1/2]
Computes the AABB.
Computes the Axis Aligned Bounding Box (AABB) for the given child shape at a given a transform.
- Warning
- Behavior is undefined if the given transformation is invalid.
- Parameters
-
proxy | Distance proxy for the child shape. |
xf | World transform of the shape. |
- Returns
- AABB for the proxy shape or the default AABB if the proxy has a zero vertex count.
- Examples
- World.cpp.
◆ ComputeAABB() [2/2]
Computes the AABB.
Computes the Axis Aligned Bounding Box (AABB) for the given child shape at the given transforms.
- Warning
- Behavior is undefined if a given transformation is invalid.
- Parameters
-
proxy | Distance proxy for the child shape. |
xfm0 | World transform 0 of the shape. |
xfm1 | World transform 1 of the shape. |
- Returns
- AABB for the proxy shape or the default AABB if the proxy has a zero vertex count.
◆ GetSupportIndex()
Gets the supporting vertex index in the given direction for the given distance proxy.
This finds the vertex that's most significantly in the direction of the given vector and returns its index.
- Note
- 0 is returned for a given zero length direction vector.
- Parameters
-
proxy | Distance proxy object to find index in if a valid index exists for it. |
dir | Direction vector to find index for. |
- Returns
InvalidVertex
if d is invalid or the count of vertices is zero, otherwise a value from 0 to one less than count.
- See also
- GetVertexCount().
The documentation for this class was generated from the following files:
- DistanceProxy.hpp
- AABB.hpp
- RayCastOutput.hpp