Line2D

@Serializable
data class Line2D(val origin: Vector2, val direction: Vector2) : LinearType<Line2D> , GeometricPrimitive2D(source)

Represents a two-dimensional line in space, defined by an origin point and a direction vector.

The Line2D class facilitates mathematical operations such as addition, subtraction, scaling, and division. It also includes methods for constructing a line based on specific parameters and operations to compute derived properties or positions along the line.

Constructors

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

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The direction vector defining the orientation of the line.

Link copied to clipboard

Provides a normalized representation of the line.

Link copied to clipboard

The starting point of the line in 2D space.

Functions

Link copied to clipboard
open operator override fun div(scale: Double): Line2D
Link copied to clipboard
open operator override fun minus(right: Line2D): Line2D
Link copied to clipboard
open operator override fun plus(right: Line2D): Line2D
Link copied to clipboard

Calculates a position on the line at a given parameter t. The position is determined by extending or retracting the line along its direction vector by t units from the origin.

Link copied to clipboard

Creates a line segment between two positions on the line, determined by the parameters t0 and t1.

Link copied to clipboard
open operator override fun times(scale: Double): Line2D