Distance Proxy. More...
#include <playrho/d2/DistanceProxy.hpp>
Public Types | |
using | ConstNormalIterator = ConstNormalPointer |
Constant normal iterator. | |
using | ConstNormalPointer = const UnitVec * |
Constant normal pointer. | |
using | ConstVertexIterator = ConstVertexPointer |
Constant vertex iterator. | |
using | ConstVertexPointer = const Length2 * |
Constant vertex pointer. | |
Public Member Functions | |
DistanceProxy ()=default | |
Default constructor. | |
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 | GetNormal (VertexCounter index) const noexcept |
Gets the normal for the given index. More... | |
Span< const UnitVec > | GetNormals () const noexcept |
Gets the normals. | |
auto | GetVertex (VertexCounter index) const noexcept |
Gets a vertex by index. More... | |
auto | GetVertexCount () const noexcept |
Gets the vertex count. More... | |
auto | GetVertexRadius () const noexcept |
Gets the vertex radius of the vertices of the associated shape. More... | |
Span< const Length2 > | GetVertices () const noexcept |
Gets the vertices. | |
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... | |
DistanceOutput | Distance (const DistanceProxy &proxyA, const Transformation &transformA, const DistanceProxy &proxyB, const Transformation &transformB, DistanceConf conf=DistanceConf{}) |
Determines the closest points between two shapes using an iterative method. More... | |
SeparationInfo | GetMaxSeparation (const DistanceProxy &proxy1, const DistanceProxy &proxy2, Length stop=MaxFloat *Meter) |
Gets the max separation information. More... | |
SeparationInfo | GetMaxSeparation (const DistanceProxy &proxy1, const Transformation &xf1, const DistanceProxy &proxy2, const Transformation &xf2) |
Gets the max separation information. More... | |
SeparationInfo | GetMaxSeparation (const DistanceProxy &proxy1, const Transformation &xf1, const DistanceProxy &proxy2, const Transformation &xf2, Length stop) |
Gets the max separation information. More... | |
SeparationInfo | GetMaxSeparation4x4 (const DistanceProxy &proxy1, const Transformation &xf1, const DistanceProxy &proxy2, const Transformation &xf2) |
Gets the max separation information for the first four vertices of the two given shapes. More... | |
template<class T > | |
VertexCounter | GetSupportIndex (const DistanceProxy &proxy, T dir) noexcept |
Gets the supporting vertex index in given direction for given distance proxy. More... | |
auto | GetVertexRadius (const DistanceProxy &arg) noexcept |
Gets the vertex radius property of a given distance proxy. | |
bool | operator!= (const DistanceProxy &lhs, const DistanceProxy &rhs) noexcept |
Determines with the two given distance proxies are not equal. | |
bool | operator== (const DistanceProxy &lhs, const DistanceProxy &rhs) noexcept |
Determines with the two given distance proxies are equal. | |
RayCastOutput | RayCast (const DistanceProxy &proxy, const RayCastInput &input, const Transformation &transform) noexcept |
Cast a ray against the distance proxy. More... | |
Area | TestOverlap (const DistanceProxy &proxyA, const Transformation &xfA, const DistanceProxy &proxyB, const Transformation &xfB, DistanceConf conf=DistanceConf{}) |
Determine if two generic shapes overlap. More... | |
bool | TestPoint (const DistanceProxy &proxy, const Length2 &point) noexcept |
Tests a point for containment in the given distance proxy. More... | |
Distance Proxy.
A distance proxy aggregates a convex set of vertices, their normals, 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.
DistanceProxy
does not outlive the pointed-to vertices or normals!
|
inlinenoexcept |
Copy constructor.
DistanceProxy
does not outlive the copied from DistanceProxy
.
|
inlinenoexcept |
Initializing constructor.
Constructs a distance proxy for n-point shape (like a polygon).
vertexRadius | Radius of the given vertices. |
count | Count of elements of the vertices and normals arrays. |
vertices | Pointer to array of vertices of shape (relative to shape's origin). |
normals | Pointer to array of normals of the shape. |
MaxShapeVertices
elements. DistanceProxy
does not outlive the pointed-to vertices or normals! MaxShapeVertices
elements.
|
inlinenoexcept |
Gets the normal for the given index.
index
is less than GetVertexCount()
. Referenced by playrho::d2::GetManifold(), GetMaxSeparation(), and GetMaxSeparation4x4().
|
inlinenoexcept |
Gets a vertex by index.
index | Index value less than count of vertices represented by this proxy. |
index
is less than GetVertexCount()
. Referenced by playrho::d2::Manifold::CollideShapes(), playrho::d2::GetManifold(), GetMaxSeparation(), GetMaxSeparation4x4(), and playrho::d2::GetSeparationScenario().
|
inlinenoexcept |
Gets the vertex count.
This is the count of valid vertex elements that this object provides.
MaxShapeVertices
. Referenced by playrho::d2::Manifold::CollideShapes(), Distance(), playrho::d2::GetManifold(), GetMaxSeparation(), playrho::d2::GetSeparationScenario(), and playrho::d2::Shape::GetVertexCount().
|
inlinenoexcept |
Gets the vertex radius of the vertices of the associated shape.
Referenced by playrho::d2::Manifold::CollideShapes(), playrho::d2::GetManifold(), and TestOverlap().
|
related |
Computes the AABB.
Computes the Axis Aligned Bounding Box (AABB) for the given child shape at a given a transform.
proxy | Distance proxy for the child shape. |
xf | World transform of the shape. |
xf
is valid.
|
related |
Computes the AABB.
Computes the Axis Aligned Bounding Box (AABB) for the given child shape at the given transforms.
proxy | Distance proxy for the child shape. |
xfm0 | World transform 0 of the shape. |
xfm1 | World transform 1 of the shape. |
xfm0
and xfm1
are both valid.
|
related |
Determines the closest points between two shapes using an iterative method.
size(conf.cache.indices)
should be zero. proxyA | Proxy A. |
transformA | Transform of A. |
proxyB | Proxy B. |
transformB | Transform of B. |
conf | Configuration to use including the simplex cache for assisting the determination. |
DefaultMaxDistanceIters
is zero.
|
related |
Gets the max separation information.
proxy1
, index of the vertex from proxy2
(that had the maximum separation distance from each other in the direction of that normal), and the maximal distance.
|
related |
Gets the max separation information.
GetMaxSeparation
function that takes a stopping length - when it's already known that the two convex shapes' AABBs overlap. proxy1
, index of the vertex from proxy2
(that had the maximum separation distance from each other in the direction of that normal), and the maximal distance.Referenced by playrho::d2::Manifold::CollideShapes().
|
related |
Gets the max separation information.
proxy1
, index of the vertex from proxy2
(that had the maximum separation distance from each other in the direction of that normal), and the maximal distance.
|
related |
Gets the max separation information for the first four vertices of the two given shapes.
This is a version of the get-max-separation functions that is optimized for two quadrilateral (4-sided) polygons.
proxy1
, index of the vertex from proxy2
(that had the maximum separation distance from each other in the direction of that normal), and the maximal distance.Referenced by playrho::d2::Manifold::CollideShapes().
|
related |
Gets the supporting vertex index in given direction for given distance proxy.
This finds the vertex that's most significantly in direction of the given vector and returns its index.
proxy | Distance proxy object to find index in if a valid index exists for it. |
dir | Direction vector to find index for. |
InvalidVertex
if d is invalid or the count of vertices is zero, otherwise a value from 0 to one less than count.
|
related |
Determine if two generic shapes overlap.
CollideShapes
function. This is not always the case however especially when the separation or overlap distance is closer to zero.