-
- All Implemented Interfaces:
public final class Ray
Ray class to define and project rays in a world.
-
-
Field Summary
Fields Modifier and Type Field Description private final Double
distance
private Vec2
direction
private RayInformation
rayInformation
private Vec2
startPoint
-
Constructor Summary
Constructors Constructor Description Ray(Double direction, Double distance)
Convenience constructor with ray set at origin. Ray(Vec2 direction, Double distance)
Convenience constructor with ray set at origin. Ray(Vec2 startPoint, Double direction, Double distance)
Convenience constructor. Ray(Vec2 startPoint, Vec2 direction, Double distance)
-
Method Summary
Modifier and Type Method Description final Double
getDistance()
final Vec2
getDirection()
Gets the direction of the ray in radians. final Unit
setDirection(Vec2 direction)
Gets the direction of the ray in radians. final RayInformation
getRayInformation()
final Unit
setRayInformation(RayInformation rayInformation)
final Vec2
getStartPoint()
final Unit
setStartPoint(Vec2 startPoint)
final Unit
updateProjection(ArrayList<TranslatableBody> bodiesToEvaluate)
Updates the projection in world space and acquires information about the closest intersecting object with the ray projection. -
-
Constructor Detail
-
Ray
Ray(Double direction, Double distance)
Convenience constructor with ray set at origin.- Parameters:
direction
- The direction of the ray points in radians.distance
- The distance the ray is projected
-
Ray
Ray(Vec2 direction, Double distance)
Convenience constructor with ray set at origin.- Parameters:
direction
- The direction of the ray points.distance
- The distance the ray is projected
-
Ray
Ray(Vec2 startPoint, Double direction, Double distance)
Convenience constructor.- Parameters:
startPoint
- The origin of the rays projection.direction
- The direction of the ray points in radians.distance
- The distance the ray is projected
-
-
Method Detail
-
getDistance
final Double getDistance()
-
getDirection
final Vec2 getDirection()
Gets the direction of the ray in radians.
-
setDirection
final Unit setDirection(Vec2 direction)
Gets the direction of the ray in radians.
-
getRayInformation
final RayInformation getRayInformation()
-
setRayInformation
final Unit setRayInformation(RayInformation rayInformation)
-
getStartPoint
final Vec2 getStartPoint()
-
setStartPoint
final Unit setStartPoint(Vec2 startPoint)
- Parameters:
startPoint
- The origin of the rays projection.
-
updateProjection
final Unit updateProjection(ArrayList<TranslatableBody> bodiesToEvaluate)
Updates the projection in world space and acquires information about the closest intersecting object with the ray projection.
- Parameters:
bodiesToEvaluate
- Arraylist of bodies to check if they intersect with the ray projection.
-
-
-
-