Class: Line

Line(point1, point2)

class Line, a line that extends infinitely in the 2D Euclidean plane

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
Source:

Members

c

the y-coordinate of the y-intercept of the line
Source:

isHorizontal

whether the line is horizontal or not
Source:

isVertical

whether the line is vertical or not
Source:

m

the slope of the line
Source:

xIntercept

the x-intercept of the line
Source:

yIntercept

the y-intercept of the line
Source:

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
Source:
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
Source:
Returns:
the output y-coordinate, return NaN if the line is vertical
Type
Number