public static final class SegmentPartitionTree.LineSegment extends Segment
Modifier and Type | Field and Description |
---|---|
private boolean |
marked
Whether this segment is marked, used for animation.
|
private SegmentPartitionTree.LineSegment |
original
The line segment this line segment was derived
from or null if this line segment was not derived.
|
private boolean |
p1Clipped
Whether the first end point of this line was
clipped, meaning the original line segment
continues beyond the new first end point.
|
private boolean |
p2Clipped
Whether the second end point of this line was
clipped, meaning the original line segment
continues beyond the new second end point.
|
Constructor and Description |
---|
LineSegment(java.awt.geom.Line2D line)
Constructs a new line segment from the given line.
|
LineSegment(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
Constructs a new line segment with the given end points.
|
Modifier and Type | Method and Description |
---|---|
private java.awt.geom.Point2D |
boundClip(java.awt.geom.Point2D tl,
java.awt.geom.Point2D tr,
java.awt.geom.Point2D bl,
java.awt.geom.Point2D br,
int out)
Computes the intersection of this line segment with
the given rectangle in the given direction.
|
private SegmentPartitionTree.LineSegment |
deriveLine(int ccw,
java.awt.geom.Line2D intersected,
java.awt.geom.Point2D intersection)
Derives a new line from this line segment that is exactly the
part of this line that lies to the given direction of the given
intersected line segment.
|
private SegmentPartitionTree.LineSegment |
deriveLine(java.awt.geom.Rectangle2D bounds)
Derives a new line from this line segment that is exactly the
part of this line that lies within the given rectangle.
|
private SegmentPartitionTree.LineSegment |
getOriginalSegment()
Gets the original line segment this line
segment was derived from.
|
equals, getBounds2D, getP1, getP2, getX1, getX2, getY1, getY2, hashCode, setLine, toString
clone, contains, contains, contains, contains, getBounds, getPathIterator, getPathIterator, intersects, intersects, intersectsLine, intersectsLine, linesIntersect, ptLineDist, ptLineDist, ptLineDist, ptLineDistSq, ptLineDistSq, ptLineDistSq, ptSegDist, ptSegDist, ptSegDist, ptSegDistSq, ptSegDistSq, ptSegDistSq, relativeCCW, relativeCCW, relativeCCW, setLine, setLine
private SegmentPartitionTree.LineSegment original
private boolean p1Clipped
private boolean p2Clipped
private boolean marked
public LineSegment(java.awt.geom.Line2D line)
line
- The line to initialise this line segment with.public LineSegment(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
p1
- The first end point of the line.p2
- The second end point of the line.private SegmentPartitionTree.LineSegment deriveLine(java.awt.geom.Rectangle2D bounds)
bounds
- The rectangle to bound this line segment with.null
if this line segment was not (partially)
contained within the given rectangle.private java.awt.geom.Point2D boundClip(java.awt.geom.Point2D tl, java.awt.geom.Point2D tr, java.awt.geom.Point2D bl, java.awt.geom.Point2D br, int out)
tl
- The top left point of the rectangle.tr
- The top right point of the rectangle.bl
- The bottom left point of the rectangle.br
- The bottom right point of the rectangle.out
- The outcode of the either line segment point
to determine the appropriate intersection. This
value cannot be 0Rectangle2D.outcode(Point2D)
private SegmentPartitionTree.LineSegment deriveLine(int ccw, java.awt.geom.Line2D intersected, java.awt.geom.Point2D intersection)
ccw
- The direction of this line segment to returned this is specified
with the passed CCW value, which has to be either -1 or 1 (for details
see Line2D.relativeCCW(double, double, double, double, double, double)
.
In this data structure a value of -1 is generally referred to
as 'left' and a value of '1' as right.intersected
- The intersected line segment, this line segment is required
to intersect this line segment in the given intersection point.intersection
- The intersection point of this line segment and the
given intersected line.private SegmentPartitionTree.LineSegment getOriginalSegment()