Interface Line2D
-
-
Method Summary
Modifier and Type Method Description abstract Boolean
contains(P point)
Checks if the point belongs to this line. abstract P
findPoint(Double x)
Finds the point belonging to the line with the given x-coordinate. abstract Boolean
isParallelTo(Line2D<P> other)
Checks if two lines are parallel. abstract Intersection2D<P>
intersect(Line2D<P> other)
Intersects two lines. abstract Intersection2D<P>
intersectCircle(P center, Double radius)
Intersects a line and a circle. abstract Boolean
isHorizontal()
Indicates if the line is aligned to the x-axis. abstract Boolean
isVertical()
Indicates if the line is aligned to the y-axis. abstract Double
getSlope()
The slope of the line, if isVertical this is undefined (= Double.NaN). abstract Double
getYIntercept()
The y-coordinate of the y-intercept (= the point where the line intersects the y-axis). abstract Double
getXIntercept()
The x-coordinate of the x-intercept (= the point where the line intersects the x-axis). -
-
Method Detail
-
findPoint
abstract P findPoint(Double x)
Finds the point belonging to the line with the given x-coordinate. Throws an UnsupportedOperationException if the line isVertical.
-
isParallelTo
abstract Boolean isParallelTo(Line2D<P> other)
Checks if two lines are parallel.
-
intersect
abstract Intersection2D<P> intersect(Line2D<P> other)
Intersects two lines.
-
intersectCircle
abstract Intersection2D<P> intersectCircle(P center, Double radius)
Intersects a line and a circle.
-
isHorizontal
abstract Boolean isHorizontal()
Indicates if the line is aligned to the x-axis.
-
isVertical
abstract Boolean isVertical()
Indicates if the line is aligned to the y-axis.
-
getSlope
abstract Double getSlope()
The slope of the line, if isVertical this is undefined (= Double.NaN).
-
getYIntercept
abstract Double getYIntercept()
The y-coordinate of the y-intercept (= the point where the line intersects the y-axis). If isVertical there's no y-intercept and this is Double.NaN. The slope-intercept representation (y = mx + b) uses this intercept.
-
getXIntercept
abstract Double getXIntercept()
The x-coordinate of the x-intercept (= the point where the line intersects the x-axis). If isHorizontal there's no x-intercept and this is Double.NaN.
-
-
-
-