PlayRho  1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
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 ::playrho::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 World &world, const RayCastInput &input, const FixtureRayCastCB &callback)
 Ray-cast the world 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...
 
bool RayCast (const World &world, const RayCastInput &input, const FixtureRayCastCB &callback)
 Ray-cast the world for all fixtures in the path of the ray. More...
 

Detailed Description

Collection of functions that do ray casting.

Function Documentation

◆ RayCast() [1/9]

RayCastOutput playrho::d2::RayCast ( const ::playrho::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.

◆ RayCast() [2/9]

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.

◆ RayCast() [3/9]

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.

◆ RayCast() [4/9]

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.

◆ RayCast() [5/9]

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.

◆ RayCast() [6/9]

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.

◆ RayCast() [7/9]

bool RayCast ( const World world,
const RayCastInput input,
const FixtureRayCastCB callback 
)

Ray-cast the world 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
worldThe world instance to raycast in.
inputRay cast input data.
callbackA user implemented callback function.
Returns
true if terminated by callback, false otherwise.

◆ RayCast() [8/9]

bool RayCast ( const World world,
const RayCastInput input,
const FixtureRayCastCB callback 
)
related

Ray-cast the world 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
worldThe world instance to raycast in.
inputRay cast input data.
callbackA user implemented callback function.
Returns
true if terminated by callback, false otherwise.

◆ RayCast() [9/9]

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.

Referenced by playrho::d2::RayCast().