Ray class

Class representing a ray in 3D space.

@author {@link https://github.com/Mugen87|Mugen87}

Constructors

Ray([Vector3? origin, Vector3? direction])
Constructs a ray with the given values.

Properties

aabb AABB
final
direction Vector3
latefinal
edge1 Vector3
final
edge2 Vector3
final
hashCode int
The hash code for this object.
no setterinherited
inverse Matrix4
final
matrix Matrix4
final
normal Vector3
final
origin Vector3
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size Vector3
final
v1 Vector3
final

Methods

applyMatrix4(Matrix4 m) Ray
Transforms this ray by the given 4x4 matrix.
at(double t, Vector3 result) Vector3
Computes a position on the ray according to the given t value and stores the result in the given 3D vector. The t value has a range of 0, double.infinity where 0 means the position is equal with the origin of the ray.
clone() Ray
Creates a ray and copies all values from this ray.
copy(Ray ray) Ray
Copies all values from the given ray to this ray.
equals(Ray ray) bool
Returns true if the given ray is deep equal with this ray.
intersectAABB(AABB aabb, Vector3 result) Vector3?
Performs a ray/AABB intersection test and stores the intersection point to the given 3D vector. If no intersection is detected, null is returned.
intersectBoundingSphere(BoundingSphere sphere, Vector3 result) Vector3?
Performs a ray/sphere intersection test and stores the intersection point to the given 3D vector. If no intersection is detected, null is returned.
intersectBVH(BVH bvh, Vector3 result) Vector3?
Performs a ray/BVH intersection test and stores the intersection point to the given 3D vector. If no intersection is detected, null is returned.
intersectConvexHull(ConvexHull convexHull, Vector3 result) Vector3?
Performs a ray/convex hull intersection test and stores the intersection point to the given 3D vector. If no intersection is detected, null is returned. The implementation is based on "Fast Ray-Convex Polyhedron Intersection" by Eric Haines, GRAPHICS GEMS II
intersectOBB(OBB obb, Vector3 result) Vector3?
Performs a ray/OBB intersection test and stores the intersection point to the given 3D vector. If no intersection is detected, null is returned.
intersectPlane(Plane plane, Vector3 result) Vector3?
Performs a ray/plane intersection test and stores the intersection point to the given 3D vector. If no intersection is detected, null is returned.
intersectsAABB(AABB aabb) bool
Performs a ray/AABB intersection test. Returns either true or false if there is a intersection or not.
intersectsBoundingSphere(BoundingSphere sphere) bool
Performs a ray/sphere intersection test. Returns either true or false if there is a intersection or not.
intersectsBVH(BVH bvh) bool
Performs a ray/BVH intersection test. Returns either true or false if there is a intersection or not.
intersectsConvexHull(ConvexHull convexHull) bool
Performs a ray/convex hull intersection test. Returns either true or false if there is a intersection or not.
intersectsOBB(OBB obb) bool
Performs a ray/OBB intersection test. Returns either true or false if there is a intersection or not.
intersectsPlane(Plane plane) bool
Performs a ray/plane intersection test. Returns either true or false if there is a intersection or not.
intersectTriangle(Map<String, Vector3> triangle, bool backfaceCulling, Vector3 result) Vector3?
Performs a ray/triangle intersection test and stores the intersection point to the given 3D vector. If no intersection is detected, null is returned.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(Vector3 origin, Vector3 direction) Ray
Sets the given values to this ray.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited