public class Line
extends java.lang.Object
Constructor and Description |
---|
Line(double gradient,
double intercept)
Usually the intercept is on the y-axis but to represent a vertical line
it is necessary to give Double.POSITIVE_INFINITY as the gradient and then
the intercept is on the x-axis.
|
Modifier and Type | Method and Description |
---|---|
double |
calcX(double y) |
double |
calcY(double x)
Returns Double.NaN if the gradient is infinite (a vertical line).
|
LineSegment |
clip(int wd,
int ht)
Get the segment of this line which lies within a rectangle of given width
and height with top left corner at the origin (corresponding to the pixels
of an image).
|
boolean |
equals(java.lang.Object other) |
double |
getGradient() |
double |
getIntercept()
Returns the intercept on the x-axis if the gradient is infinite but
otherwise the intercept on the y-axis.
|
int |
hashCode() |
PointFloat |
intersection(Line other)
Calculate the intersection point of the current line with another one.
|
java.lang.String |
toString() |
public Line(double gradient, double intercept)
public double getGradient()
public double getIntercept()
public double calcX(double y)
public double calcY(double x)
public LineSegment clip(int wd, int ht)
public PointFloat intersection(Line other)
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object