public class Raycaster
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Raycaster.Intersect |
Modifier and Type | Field and Description |
---|---|
static double |
LINE_PRECISION
The precision factor of the raycaster when intersecting
Line objects. |
static double |
PRECISION
The precision factor of the raycaster when intersecting
Mesh objects. |
Constructor and Description |
---|
Raycaster() |
Raycaster(Vector3 origin,
Vector3 direction) |
Raycaster(Vector3 origin,
Vector3 direction,
double near,
double far)
This creates a new raycaster object.
|
Modifier and Type | Method and Description |
---|---|
double |
getFar()
The far factor of the raycaster.
|
double |
getNear()
The near factor of the raycaster.
|
Ray |
getRay()
The Ray used for the raycasting.
|
java.util.List<Raycaster.Intersect> |
intersectObject(GeometryObject object,
boolean recursive)
Checks all intersection between the ray and the object with or without the descendants.
|
java.util.List<Raycaster.Intersect> |
intersectObjects(java.util.List<? extends Object3D> objects,
boolean recursive)
Checks all intersection between the ray and the objects with or without the descendants.
|
void |
set(Vector3 origin,
Vector3 direction) |
void |
setFar(double far) |
void |
setNear(double near) |
void |
setRay(Ray ray) |
public static final double PRECISION
Mesh
objects.public static final double LINE_PRECISION
Line
objects.public Raycaster()
public Raycaster(Vector3 origin, Vector3 direction, double near, double far)
origin
- The origin vector where the ray casts from.direction
- The direction vector that gives direction to the ray.near
- All results returned are further away than near. Near can't be negative. Default value is 0.far
- All results returned are closer then far. Far can't be lower then near . Default value is Infinity.public Ray getRay()
public void setRay(Ray ray)
public double getNear()
public void setNear(double near)
public double getFar()
public void setFar(double far)
public java.util.List<Raycaster.Intersect> intersectObjects(java.util.List<? extends Object3D> objects, boolean recursive)
intersectObject(GeometryObject, boolean)
objects
- The objects to check for intersection with the ray.recursive
- If set, it also checks all descendants of the objects. Otherwise it only checks intersecton with the objects.public java.util.List<Raycaster.Intersect> intersectObject(GeometryObject object, boolean recursive)
object
- The object to check for intersection with the ray.recursive
- If set, it also checks all descendants. Otherwise it only checks intersecton with the object.