-
- All Implemented Interfaces:
public final class RayRay class to define and project rays in a world.
-
-
Field Summary
Fields Modifier and Type Field Description private final Doubledistanceprivate Vec2directionprivate RayInformationrayInformationprivate Vec2startPoint
-
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 DoublegetDistance()final Vec2getDirection()Gets the direction of the ray in radians. final UnitsetDirection(Vec2 direction)Gets the direction of the ray in radians. final RayInformationgetRayInformation()final UnitsetRayInformation(RayInformation rayInformation)final Vec2getStartPoint()final UnitsetStartPoint(Vec2 startPoint)final UnitupdateProjection(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.
-
-
-
-