Ray Casting Functions

Collection of functions that do ray casting. More...

Functions

RayCastOutput playrho::d2::RayCast (Length radius, Length2 location, const RayCastInput &input) noexcept
 Cast a ray against a circle of a given radius at the given location. More...
 
RayCastOutput playrho::d2::RayCast (const detail::AABB< 2 > &aabb, const RayCastInput &input) noexcept
 Cast a ray against the given AABB. More...
 
RayCastOutput playrho::d2::RayCast (const DistanceProxy &proxy, const RayCastInput &input, const Transformation &transform) noexcept
 Cast a ray against the distance proxy. More...
 
RayCastOutput playrho::d2::RayCast (const Shape &shape, ChildCounter childIndex, const RayCastInput &input, const Transformation &transform) noexcept
 Cast a ray against the child of the given shape. More...
 
bool playrho::d2::RayCast (const DynamicTree &tree, RayCastInput input, const DynamicTreeRayCastCB &callback)
 Cast rays against the leafs in the given tree. More...
 
bool playrho::d2::RayCast (const DynamicTree &tree, const RayCastInput &input, FixtureRayCastCB callback)
 Ray-cast the dynamic tree for all fixtures in the path of the ray. More...
 
RayCastOutput RayCast (const DistanceProxy &proxy, const RayCastInput &input, const Transformation &transform) noexcept
 Cast a ray against the distance proxy. More...
 
RayCastOutput RayCast (const Shape &shape, ChildCounter childIndex, const RayCastInput &input, const Transformation &transform) noexcept
 Cast a ray against the child of the given shape. More...
 

Detailed Description

Collection of functions that do ray casting.

Function Documentation

◆ RayCast() [1/8]

RayCastOutput playrho::d2::RayCast ( Length  radius,
Length2  location,
const RayCastInput input 
)
noexcept

Cast a ray against a circle of a given radius at the given location.

Parameters
radiusRadius of the circle.
locationLocation in world coordinates of the circle.
inputRay-cast input parameters.
Examples
World.cpp.

Definition at line 34 of file RayCastOutput.cpp.

◆ RayCast() [2/8]

RayCastOutput playrho::d2::RayCast ( const detail::AABB< 2 > &  aabb,
const RayCastInput input 
)
noexcept

Cast a ray against the given AABB.

Parameters
aabbAxis Aligned Bounding Box.
inputthe ray-cast input parameters.

Definition at line 70 of file RayCastOutput.cpp.

◆ RayCast() [3/8]

RayCastOutput RayCast ( const DistanceProxy proxy,
const RayCastInput input,
const Transformation transform 
)
noexcept

Cast a ray against the distance proxy.

Parameters
proxyDistance-proxy object (in local coordinates).
inputRay-cast input parameters.
transformTransform to be applied to the distance-proxy to get world coordinates.

Definition at line 131 of file RayCastOutput.cpp.

◆ RayCast() [4/8]

RayCastOutput RayCast ( const Shape shape,
ChildCounter  childIndex,
const RayCastInput input,
const Transformation transform 
)
noexcept

Cast a ray against the child of the given shape.

Note
This is a convenience function for calling the ray cast against a distance-proxy.
Parameters
shapeShape.
childIndexChild index.
inputthe ray-cast input parameters.
transformTransform to be applied to the child of the shape.

Definition at line 228 of file RayCastOutput.cpp.

◆ RayCast() [5/8]

bool playrho::d2::RayCast ( const DynamicTree tree,
RayCastInput  input,
const DynamicTreeRayCastCB callback 
)

Cast rays against the leafs in the given tree.

Note
This relies on the callback to perform an exact ray-cast in the case where the leaf node contains a shape.
The callback also performs collision filtering.
Performance is roughly k * log(n), where k is the number of collisions and n is the number of leaf nodes in the tree.
Parameters
treeDynamic tree to ray cast.
inputthe ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).
callbackA callback instance function that's called for each leaf that is hit by the ray. The callback should return 0 to terminate ray casting, or greater than 0 to update the segment bounding box. Values less than zero are ignored.
Returns
true if terminated at the callback's request, false otherwise.

Definition at line 234 of file RayCastOutput.cpp.

◆ RayCast() [6/8]

bool playrho::d2::RayCast ( const DynamicTree tree,
const RayCastInput input,
FixtureRayCastCB  callback 
)

Ray-cast the dynamic tree for all fixtures in the path of the ray.

Note
The callback controls whether you get the closest point, any point, or n-points.
The ray-cast ignores shapes that contain the starting point.
Parameters
treeDynamic tree to ray cast.
inputRay cast input data.
callbackA user implemented callback function.
Returns
true if terminated by callback, false otherwise.

Definition at line 293 of file RayCastOutput.cpp.

◆ RayCast() [7/8]

RayCastOutput RayCast ( const DistanceProxy proxy,
const RayCastInput input,
const Transformation transform 
)
related

Cast a ray against the distance proxy.

Parameters
proxyDistance-proxy object (in local coordinates).
inputRay-cast input parameters.
transformTransform to be applied to the distance-proxy to get world coordinates.
Examples
World.cpp.

Definition at line 131 of file RayCastOutput.cpp.

◆ RayCast() [8/8]

RayCastOutput RayCast ( const Shape shape,
ChildCounter  childIndex,
const RayCastInput input,
const Transformation transform 
)
related

Cast a ray against the child of the given shape.

Note
This is a convenience function for calling the ray cast against a distance-proxy.
Parameters
shapeShape.
childIndexChild index.
inputthe ray-cast input parameters.
transformTransform to be applied to the child of the shape.

Definition at line 228 of file RayCastOutput.cpp.