Line
+ new Line(): Line
Returns: Line
+ new Line(startX
: number, startY
: number, endX
: number, endY
: number): Line
Parameters:
Returns: Line
• endX: number
• endY: number
• startX: number
• startY: number
▸ add(line
: Line | Point): this
Parameters:
Returns: this
▸ add(x
: number, y
: number): this
Parameters:
Returns: this
▸ clone(): Line‹›
Returns a copy of Line that can be mutated separately.
Returns: 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(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(): number
Returns: number
▸ 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(line
: Line | Point): this
Parameters:
Returns: this
▸ offset(x
: number, y
: number): this
Parameters:
Returns: this
▸ 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(): string
Returns: string
Name
Type
startX
number
startY
number
endX
number
endY
number
Name
Type
line
Name
Type
x
number
y
number
Name
Type
line
Name
Type
distance
number
Name
Type
distance
number
Name
Type
line
Name
Type
x
number
y
number
Name
Type
Default
position
number
-
result
new Point()