Distance Proxy. More...
#include <DistanceProxy.hpp>
Public Types | |
using | ConstVertexPointer = const Length2 * |
Constant vertex pointer. More... | |
using | ConstVertexIterator = ConstVertexPointer |
Constant vertex iterator. More... | |
using | ConstNormalPointer = const UnitVec * |
Constant normal pointer. More... | |
using | ConstNormalIterator = ConstNormalPointer |
Constant normal iterator. More... | |
Public Member Functions | |
DistanceProxy ()=default | |
DistanceProxy (const DistanceProxy ©) noexcept | |
Copy constructor. More... | |
DistanceProxy (const NonNegative< Length > vertexRadius, const VertexCounter count, const Length2 *vertices, const UnitVec *normals) noexcept | |
Initializing constructor. More... | |
auto | GetVertexRadius () const noexcept |
Range< ConstVertexIterator > | GetVertices () const noexcept |
Gets the range of vertices. More... | |
Range< ConstNormalIterator > | GetNormals () const noexcept |
Gets the range of normal. More... | |
auto | GetVertexCount () const noexcept |
auto | GetVertex (VertexCounter index) const noexcept |
auto | GetNormal (VertexCounter index) const noexcept |
Gets the normal for the given index. More... | |
Related Functions | |
(Note that these are not member functions.) | |
AABB | ComputeAABB (const DistanceProxy &proxy, const Transformation &xf) noexcept |
Computes the AABB. More... | |
AABB | ComputeAABB (const DistanceProxy &proxy, const Transformation &xfm0, const Transformation &xfm1) noexcept |
Computes the AABB. More... | |
bool | operator== (const DistanceProxy &lhs, const DistanceProxy &rhs) noexcept |
Determines with the two given distance proxies are equal. More... | |
bool | operator!= (const DistanceProxy &lhs, const DistanceProxy &rhs) noexcept |
Determines with the two given distance proxies are not equal. More... | |
template<class T > | |
VertexCounter | GetSupportIndex (const DistanceProxy &proxy, T dir) noexcept |
Gets the supporting vertex index in the given direction for the given distance proxy. More... | |
bool | TestPoint (const DistanceProxy &proxy, Length2 point) noexcept |
Tests a point for containment in the given distance proxy. More... | |
RayCastOutput | RayCast (const DistanceProxy &proxy, const RayCastInput &input, const Transformation &transform) noexcept |
Cast a ray against the distance proxy. More... | |
Detailed Description
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.
Definition at line 51 of file DistanceProxy.hpp.
Member Typedef Documentation
◆ ConstVertexPointer
using playrho::d2::DistanceProxy::ConstVertexPointer = const Length2* |
Constant vertex pointer.
Definition at line 55 of file DistanceProxy.hpp.
◆ ConstVertexIterator
Constant vertex iterator.
Definition at line 58 of file DistanceProxy.hpp.
◆ ConstNormalPointer
using playrho::d2::DistanceProxy::ConstNormalPointer = const UnitVec* |
Constant normal pointer.
Definition at line 61 of file DistanceProxy.hpp.
◆ ConstNormalIterator
Constant normal iterator.
Definition at line 64 of file DistanceProxy.hpp.
Constructor & Destructor Documentation
◆ DistanceProxy() [1/3]
|
default |
◆ DistanceProxy() [2/3]
|
inlinenoexcept |
Copy constructor.
Definition at line 69 of file DistanceProxy.hpp.
◆ DistanceProxy() [3/3]
|
inlinenoexcept |
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.
Definition at line 104 of file DistanceProxy.hpp.
Member Function Documentation
◆ GetVertexRadius()
|
inlinenoexcept |
Gets the vertex radius of the vertices of the associated shape.
- Returns
- Non-negative distance.
Definition at line 131 of file DistanceProxy.hpp.
◆ GetVertices()
|
inlinenoexcept |
Gets the range of vertices.
Definition at line 134 of file DistanceProxy.hpp.
◆ GetNormals()
|
inlinenoexcept |
Gets the range of normal.
Definition at line 140 of file DistanceProxy.hpp.
◆ GetVertexCount()
|
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.
Definition at line 149 of file DistanceProxy.hpp.
◆ GetVertex()
|
inlinenoexcept |
Gets a vertex by index.
- Parameters
-
index Index value less than the count of vertices represented by this proxy.
- Warning
- Behavior is undefined if the index given is not less than the count of vertices represented by this proxy.
-
Behavior is undefined if
InvalidVertex
is given as the index value.
- Returns
- Vertex linear position (relative to the shape's origin) at the given index.
- See also
- Distance.
Definition at line 164 of file DistanceProxy.hpp.
◆ GetNormal()
|
inlinenoexcept |
Gets the normal for the given index.
Definition at line 172 of file DistanceProxy.hpp.
Friends And Related Function Documentation
◆ ComputeAABB() [1/2]
|
related |
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]
|
related |
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.
◆ operator==()
|
related |
Determines with the two given distance proxies are equal.
Definition at line 28 of file DistanceProxy.cpp.
◆ operator!=()
|
related |
Determines with the two given distance proxies are not equal.
Definition at line 199 of file DistanceProxy.hpp.
◆ GetSupportIndex()
|
related |
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().
Definition at line 221 of file DistanceProxy.hpp.
The documentation for this class was generated from the following files:
- Collision/DistanceProxy.hpp
- Collision/AABB.hpp
- Collision/RayCastOutput.hpp