# Line

• Line

## Constructors

### constructor

+ new Line(): Line

Returns: Line

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

Parameters:

 Name Type startX number startY number endX number endY number

Returns: Line

endX: number

endY: number

startX: number

startY: number

## Methods

Parameters:

 Name Type line

Returns: this

Parameters:

 Name Type x number y number

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:

 Name Type line Line

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:

 Name Type distance number

Returns: this

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:

 Name Type distance number

Returns: this

### offset

offset(line: Line | Point): this

Parameters:

 Name Type line

Returns: this

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

Parameters:

 Name Type x number y number

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:

 Name Type Default position number - result Point new Point()

Returns: Point

### toString

toString(): string

Returns: string

Last updated