public class Line extends java.lang.Object
A class for line objects.
Constructor and Description |
---|
Line()
Simple constructor to create an instance of the Line object
|
Line(double slope,
double yInt)
Constructor to create a instance of the Line object and define
all instance variables.
|
Line(double x1,
double y1,
double x2,
double y2)
Constructor to create a instance of the Line object and define
all instance variables.
|
Modifier and Type | Method and Description |
---|---|
double |
forecastX(double y)
Returns the associated X value on the line for a given Y value
|
double |
forecastY(double x)
Returns the associated Y value on the line for a given X value
|
double |
getSlope()
Returns the value of the slope
|
double |
getYInt()
Returns the value of the Y-Intercept
|
void |
setSlope(double slopeVal)
Explicitly sets the value of the slope
|
void |
setYInt(double yIntVal)
Explicitly sets the value of the Y-Intercept
|
public Line()
public Line(double x1, double y1, double x2, double y2)
x1
- - first x-coordinate data pointy1
- - first y-coordinate data pointx2
- - second x-coordinate data pointy2
- - second y-coordinate data pointpublic Line(double slope, double yInt)
slope
- - the slope of the lineyInt
- - the Y-intercept of the linepublic double getSlope()
public double getYInt()
public double forecastY(double x)
x
- valuepublic double forecastX(double y)
y
- value. In the event that the slope is zero, an error
value of -99999.999 is returned.public void setSlope(double slopeVal)
slopeVal
- -- value of the slopepublic void setYInt(double yIntVal)
yIntVal
- -- value of the Y-Intercept