Line

Hierarchy

  • Line

Index

Constructors

Properties

Methods

Constructors

constructor

+ new Line(): Line

Returns: Line

+ new Line(startX: number, startY: number, endX: number, endY: number): Line

Parameters:

Returns: Line

Properties

endX

endX: number

endY

endY: number

startX

startX: number

startY

startY: number

Methods

add

add(line: Line | Point): this

Parameters:

Returns: this

add(x: number, y: number): this

Parameters:

Returns: this

clone

clone(): Line‹›

Returns a copy of Line that can be mutated separately.

Returns: Line‹›

cloneTo

cloneTo(line: Line): Line‹›

Copies all of this Line's properties to a Line specified in an argument. Returns the line passed as argument.

Parameters:

Returns: Line‹›

extend

extend(distance: number): this

Extends this line by a specified distance. Starting point remains the same, ending point changes it's place by the distance. If current line has the length of 0, it's extended horizontally. Resulting Line is the same, mutated Line.

Parameters:

Returns: this

length

length(): number

Returns: number

move

move(distance: number): this

Moves this line by a specified distance on the same angle. Acting similarly to {@link Line#extend}, but modifies both starting and ending points by a specified distance. If current line has the length of 0, it's moved horizontally. Resulting Line is the same, mutated Line.

Parameters:

Returns: this

offset

offset(line: Line | Point): this

Parameters:

Returns: this

offset(x: number, y: number): this

Parameters:

Returns: this

pointAt

pointAt(position: number, result: Point): Point

Returns a point on this line, at specified position (ranged from 0 to 1). I.e. to get the center of line, pass 0.5. Creates a new Point, but in order to reuse the existing one, you can pass it as a second argument.

Parameters:

Returns: Point

toString

toString(): string

Returns: string

Last updated