Constructor
new Line(point1, point2)
Parameters:
| Name | Type | Description |
|---|---|---|
point1 |
Point | the first point that defines the line |
point2 |
Point | the second point that defines the line |
Members
c
the y-coordinate of the y-intercept of the line
isHorizontal
whether the line is horizontal or not
isVertical
whether the line is vertical or not
m
the slope of the line
xIntercept
the x-intercept of the line
yIntercept
the y-intercept of the line
Methods
calX(y) → {Number}
get the x-coordinate of the given y-coordinate on the line
Parameters:
| Name | Type | Description |
|---|---|---|
y |
Number | the input y-coodinate |
Returns:
the output x-coordinate, return NaN if the line is horizontal
- Type
- Number
calY(x) → {Number}
get the y-coordinate of a given x-coordinate on the line
Parameters:
| Name | Type | Description |
|---|---|---|
x |
Number | the input x-coordinate |
Returns:
the output y-coordinate, return NaN if the line is vertical
- Type
- Number