Ray2 class

A ray in the 2d plane.

The direction should be normalized.

Constructors

Ray2({required Vector2 origin, required Vector2 direction})
Ray2.zero()

Properties

direction ↔ Vector2
The normalized direction of the ray.
getter/setter pair
directionInvX ↔ double
getter/setter pair
directionInvY ↔ double
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
origin ↔ Vector2
The point where the ray originates from.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

clone() → Ray2
Deep clones the object, i.e. both origin and direction are cloned into a new Ray2 object.
intersectsWithAabb2(Aabb2 box) → bool
Whether the ray intersects the box or not.
lineSegmentIntersection(LineSegment segment) → double?
Returns where (length wise) on the ray that the ray intersects the LineSegment or null if there is no intersection.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
point(double length, {Vector2? out}) → Vector2
Gives the point at a certain length along the ray.
setFrom(Ray2 other) → void
Sets the values by copying them from other.
setWith({required Vector2 origin, required Vector2 direction}) → void
toString() → String
A string representation of this object.
override

Operators

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