Line
- Line
Parameters:
Name | Type |
startX | number |
startY | number |
endX | number |
endY | number |
• endX: number
• endY: number
• startX: number
• startY: number
Parameters:
Returns: this
▸ add(
x
: number, y
: number): thisParameters:
Name | Type |
x | number |
y | number |
Returns: this
Returns a copy of Line that can be mutated separately.
Copies all of this Line's properties to a Line specified in an argument. Returns the line passed as argument.
Parameters:
Name | Type |
line |
▸ extend(
distance
: number): thisExtends 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(
distance
: number): thisMoves 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
Parameters:
Returns: this
▸ offset(
x
: number, y
: number): thisParameters:
Name | Type |
x | number |
y | number |
Returns: this
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 | new Point() |
▸ toString(): string
Returns: string
Last modified 3yr ago