API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classLine

@codexo/exojs / math / stable

Mutable line segment defined by two endpoint positions. Implements ShapeLike for intersection tests against all shape types. Note: `collidesWith` always returns `null` — lines support boolean intersection only; SAT response is not implemented for line segments. `contains(x, y, threshold)` tests whether `(x, y)` lies on the segment within a configurable threshold (default `0.1`). `Line.temp` is a shared scratch instance.

8
props
11
methods
0
events
Import
import { Line } from '@codexo/exojs'

Mutable line segment defined by two endpoint positions. Implements ShapeLike for intersection tests against all shape types.

Note: `collidesWith` always returns `null` — lines support boolean intersection only; SAT response is not implemented for line segments. `contains(x, y, threshold)` tests whether `(x, y)` lies on the segment within a configurable threshold (default `0.1`).

`Line.temp` is a shared scratch instance.

Constructors 1
new(x1: number, y1: number, x2: number, y2: number): Line
Methods 11
clone(): this
collidesWith(_target: Collidable): CollisionResponse | null
contains(x: number, y: number, threshold: number): boolean
copy(line: Line): this
destroy(): void
equals(__namedParameters: Partial<Line>): boolean
getBounds(): Rectangle
getNormals(): Vector[]
intersectsWith(target: Collidable): boolean
project(axis: Vector, result: Interval): Interval
set(x1: number, y1: number, x2: number, y2: number): this
Properties 8
collisionType: CollisionType
fromPosition: Vector
fromX: number
fromY: number
toPosition: Vector
toX: number
toY: number
temp: Line
Source