MutableRay

class MutableRay(origin: Vector2F, direction: Vector2F) : Ray, MutableTransformable

Represents a mutable transformable ray in a two-dimensional Euclidean space.

Parameters

direction

the value is expected to be normalized.

Constructors

Link copied to clipboard
constructor(origin: Vector2F, direction: Vector2F)

Creates a new instance of MutableRay.

Properties

Link copied to clipboard
open override val direction: Vector2F

Returns the direction of this ray.

Link copied to clipboard
open override val orientation: ComplexF

Returns the orientation of this object in reference to the origin of ComplexF.ONE.

Link copied to clipboard
open override val origin: Vector2F

Returns the origin of this ray.

Link copied to clipboard
open override val position: Vector2F

Returns the position of this object in reference to the origin of Vector2F.ZERO.

Functions

Link copied to clipboard
fun calibrate()

Calibrates the properties of this instance. If the direction cannot be normalized, it will take the value of Vector2F(x=1, y=0).

Link copied to clipboard
open override fun closestPointTo(point: Vector2F): Vector2F

Returns the closest point on this ray to the given point.

Link copied to clipboard
open operator override fun component1(): Vector2F

Returns the origin of this ray.

Link copied to clipboard
open operator override fun component2(): Vector2F

Returns the direction of this ray.

Link copied to clipboard
open operator override fun contains(point: Vector2F): Boolean

Returns true if this ray approximately contains the given point.

Link copied to clipboard
open override fun copy(origin: Vector2F, direction: Vector2F): MutableRay

Returns a copy of this instance with specified properties changed.

Link copied to clipboard
open override fun dilateBy(point: Vector2F, factor: Float)

Dilates this object around the point by a factor.

Link copied to clipboard
open override fun dilatedBy(point: Vector2F, factor: Float): MutableRay

Returns a copy of this object that is dilated around the point by a factor.

Link copied to clipboard

Indicates whether the other MutableRay is equal to this one.

open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun interpolate(from: Ray, to: Ray, by: Float)

Sets this ray with the result of interpolation from one ray to another ray by a factor.

Link copied to clipboard
open override fun interpolated(to: Ray, by: Float): MutableRay

Returns a copy of this ray interpolated to other ray by a factor.

Link copied to clipboard
open override fun intersects(annulus: Annulus): Boolean

Returns true if this ray intersects the given annulus.

open override fun intersects(circle: Circle): Boolean

Returns true if this ray intersects the given circle.

open override fun intersects(lineSegment: LineSegment): Boolean

Returns true if this ray intersects the given lineSegment.

open override fun intersects(ray: Ray): Boolean

Returns true if this ray intersects the given ray.

open override fun intersects(rectangle: Rectangle): Boolean
open override fun intersects(rectangle: RoundedRectangle): Boolean

Returns true if this ray intersects the given rectangle.

open override fun intersects(polygon: RegularPolygon): Boolean

Returns true if this ray intersects the given polygon.

open override fun intersects(triangle: RegularTriangle): Boolean
open override fun intersects(triangle: Triangle): Boolean

Returns true if this ray intersects the given triangle.

open override fun intersects(square: Square): Boolean

Returns true if this ray intersects the given square.

Link copied to clipboard
open override fun moveBy(displacement: Vector2F)

Moves this object by a displacement.

Link copied to clipboard
open override fun movedBy(displacement: Vector2F): MutableRay

Returns a copy of this object that is moved by a displacement.

Link copied to clipboard
open override fun movedTo(position: Vector2F): MutableRay

Returns a copy of this object that is moved to the position.

Link copied to clipboard
open override fun moveTo(position: Vector2F)

Moves this object to the position.

Link copied to clipboard
open override fun rotateAroundPointBy(point: Vector2F, rotation: AngleF)
open override fun rotateAroundPointBy(point: Vector2F, rotation: ComplexF)

Rotates this object around the point by a rotation.

Link copied to clipboard
open override fun rotateAroundPointTo(point: Vector2F, orientation: AngleF)
open override fun rotateAroundPointTo(point: Vector2F, orientation: ComplexF)

Rotates this object around the point to the orientation.

Link copied to clipboard
open override fun rotateBy(rotation: AngleF)
open override fun rotateBy(rotation: ComplexF)

Rotates this object by a rotation.

Link copied to clipboard
open override fun rotatedAroundPointBy(point: Vector2F, rotation: AngleF): MutableRay
open override fun rotatedAroundPointBy(point: Vector2F, rotation: ComplexF): MutableRay

Returns a copy of this object that is rotated around the point by a rotation.

Link copied to clipboard
open override fun rotatedAroundPointTo(point: Vector2F, orientation: AngleF): MutableRay
open override fun rotatedAroundPointTo(point: Vector2F, orientation: ComplexF): MutableRay

Returns a copy of this object that is rotated around the point to the orientation.

Link copied to clipboard
open override fun rotatedBy(rotation: AngleF): MutableRay
open override fun rotatedBy(rotation: ComplexF): MutableRay

Returns a copy of this object that is rotated by a rotation.

Link copied to clipboard
open override fun rotatedTo(orientation: AngleF): MutableRay
open override fun rotatedTo(orientation: ComplexF): MutableRay

Returns a copy of this object that is rotated to the orientation.

Link copied to clipboard
open override fun rotateTo(orientation: AngleF)
open override fun rotateTo(orientation: ComplexF)

Rotates this object to the orientation.

Link copied to clipboard
open override fun scaleBy(factor: Float)

Scales this object by a factor.

Link copied to clipboard
open override fun scaledBy(factor: Float): MutableRay

Returns a copy of this object that is scaled by a factor.

Link copied to clipboard
fun set(origin: Vector2F = this.origin, direction: Vector2F = this.direction)

Sets the specified properties of this instance.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun transformBy(displacement: Vector2F, rotation: AngleF)
open override fun transformBy(displacement: Vector2F, rotation: ComplexF)

Transforms this object by moving by a displacement and rotating by a rotation.

open override fun transformBy(displacement: Vector2F, rotation: AngleF, scaleFactor: Float)
open override fun transformBy(displacement: Vector2F, rotation: ComplexF, scaleFactor: Float)

Transforms this object by moving by a displacement, rotating by a rotation, and scaling by a scaleFactor.

Link copied to clipboard
open override fun transformedBy(displacement: Vector2F, rotation: AngleF): MutableRay
open override fun transformedBy(displacement: Vector2F, rotation: ComplexF): MutableRay

Returns a copy of this object that is moved by a displacement and rotated by a rotation.

open override fun transformedBy(displacement: Vector2F, rotation: AngleF, scaleFactor: Float): MutableRay
open override fun transformedBy(displacement: Vector2F, rotation: ComplexF, scaleFactor: Float): MutableRay

Returns a copy of this object that is moved by a displacement, rotated by a rotation, and scaled by a scaleFactor.

Link copied to clipboard
open override fun transformedTo(position: Vector2F, orientation: AngleF): MutableRay
open override fun transformedTo(position: Vector2F, orientation: ComplexF): MutableRay

Returns a copy of this object that is moved to the position and rotated to the orientation.

Link copied to clipboard
open override fun transformTo(position: Vector2F, orientation: AngleF)
open override fun transformTo(position: Vector2F, orientation: ComplexF)

Transforms this object by moving to the position and rotating to the orientation.