Constructor
new Line(x1, y1, x2, y2)
Creates a new line defined by 2 points.
Parameters:
Name | Type | Description |
---|---|---|
x1 |
number | The X coordinate of the first point. |
y1 |
number | The Y coordinate of the first point. |
x2 |
number | The X coordinate of the second point. |
y2 |
number | The Y coordinate of the second point. |
- Source:
Methods
getAngle(otherLine) → {number}
Calculate the angle between this line and another.
Parameters:
Name | Type | Description |
---|---|---|
otherLine |
module:player/TouchGestures.Line | The line defining the second leg of the angle. |
- Source:
Returns:
the angle in degree
- Type
- number
getMidpoint() → {object}
The Midpoint of this line in x and y coordinate
- Source:
Returns:
- X and Y coordinate of the midpoint.
- Type
- object
getSqrLength() → {number}
Calculates the square of the line's length.
- Source:
Returns:
the square to the line's length.
- Type
- number
getXDist(otherLine) → {number}
Calculates the average horizontal distance to another line according to the two definition points.
Parameters:
Name | Type | Description |
---|---|---|
otherLine |
module:player/TouchGestures.Line | The line to calculate the distance to. |
- Source:
Returns:
the average horizontal distance.
- Type
- number
getYDist(otherLine) → {number}
Calculates the average vertical distance to another line according to the two definition points.
Parameters:
Name | Type | Description |
---|---|---|
otherLine |
module:player/TouchGestures.Line | The line to calculate the distance to. |
- Source:
Returns:
the average vertical distance.
- Type
- number