public class RayAabIntersection extends Object
It is an efficient implementation when testing many axis-aligned boxes against the same ray.
This class is thread-safe and can be used in a multithreaded environment when testing many axis-aligned boxes against the same ray concurrently.
Constructor and Description |
---|
RayAabIntersection()
Create a new
RayAabIntersection without initializing a ray. |
RayAabIntersection(float originX,
float originY,
float originZ,
float dirX,
float dirY,
float dirZ)
Create a new
RayAabIntersection and initialize it with a ray with origin (originX, originY, originZ)
and direction (dirX, dirY, dirZ). |
Modifier and Type | Method and Description |
---|---|
void |
set(float originX,
float originY,
float originZ,
float dirX,
float dirY,
float dirZ)
Update the ray stored by this
RayAabIntersection with the new origin (originX, originY, originZ)
and direction (dirX, dirY, dirZ). |
boolean |
test(float minX,
float minY,
float minZ,
float maxX,
float maxY,
float maxZ)
Test whether the ray stored in this
RayAabIntersection intersect the axis-aligned box
given via its minimum corner (minX, minY, minZ) and its maximum corner (maxX, maxY, maxZ). |
public RayAabIntersection()
RayAabIntersection
without initializing a ray.
Before using the intersect()
method,
the method set()
must be called in order to
initialize the created RayAabIntersection instance with a ray.
public RayAabIntersection(float originX, float originY, float originZ, float dirX, float dirY, float dirZ)
RayAabIntersection
and initialize it with a ray with origin (originX, originY, originZ)
and direction (dirX, dirY, dirZ).
In order to change the direction and/or origin of the ray later, use set()
.
originX
- the x coordinate of the originoriginY
- the y coordinate of the originoriginZ
- the z coordinate of the origindirX
- the x coordinate of the directiondirY
- the y coordinate of the directiondirZ
- the z coordinate of the directionset(float, float, float, float, float, float)
public void set(float originX, float originY, float originZ, float dirX, float dirY, float dirZ)
RayAabIntersection
with the new origin (originX, originY, originZ)
and direction (dirX, dirY, dirZ).originX
- the x coordinate of the ray originoriginY
- the y coordinate of the ray originoriginZ
- the z coordinate of the ray origindirX
- the x coordinate of the ray directiondirY
- the y coordinate of the ray directiondirZ
- the z coordinate of the ray directionpublic boolean test(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
RayAabIntersection
intersect the axis-aligned box
given via its minimum corner (minX, minY, minZ) and its maximum corner (maxX, maxY, maxZ).
This implementation uses a tableswitch to dispatch to the correct intersection method.
This method is thread-safe and can be used to test many axis-aligned boxes concurrently.
minX
- the x coordinate of the minimum cornerminY
- the y coordinate of the minimum cornerminZ
- the z coordinate of the minimum cornermaxX
- the x coordinate of the maximum cornermaxY
- the y coordinate of the maximum cornermaxZ
- the z coordinate of the maximum cornertrue
iff the ray intersects the given axis-aligned box; false
otherwiseCopyright © 2015–2017 JOML. All rights reserved.