Package org.jfree.chart.util
Class GeomUtil
- java.lang.Object
-
- org.jfree.chart.util.GeomUtil
-
public final class GeomUtil extends java.lang.Object
Some utility methods for working with geometry in Java2D.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
GeomUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.geom.Point2D
calculateIntersectionPoint(java.awt.geom.Line2D lineA, java.awt.geom.Line2D lineB)
Calculates the intersection point oflineA
withlineB
, possiblynull
if no intersection point exists (i.e.static java.awt.geom.Point2D[]
calculateIntersectionPoints(java.awt.geom.Line2D lineA, java.awt.geom.Line2D... lines)
For each line inlines
, calculates its intersection point withlineA
, possibly no intersection point exists (i.e.static java.awt.geom.Line2D[]
getLines(java.awt.Shape shape, java.awt.geom.AffineTransform at)
Returns allline segments
building up ashape
.
-
-
-
Method Detail
-
calculateIntersectionPoints
public static java.awt.geom.Point2D[] calculateIntersectionPoints(java.awt.geom.Line2D lineA, java.awt.geom.Line2D... lines)
For each line inlines
, calculates its intersection point withlineA
, possibly no intersection point exists (i.e. parallel lines).- Parameters:
lineA
- line to calculate the intersection point for.lines
- lines to calculate the intersection points with.- Returns:
- all intersections points between
lineA
andlines
. - See Also:
calculateIntersectionPoint(Line2D, Line2D)
-
calculateIntersectionPoint
public static java.awt.geom.Point2D calculateIntersectionPoint(java.awt.geom.Line2D lineA, java.awt.geom.Line2D lineB)
Calculates the intersection point oflineA
withlineB
, possiblynull
if no intersection point exists (i.e. parallel lines).- Parameters:
lineA
- the first line for the calculationlineB
- the second line for the calculation- Returns:
- the intersection point of
lineA
withlineB
, possiblynull
if no intersection point exists
-
getLines
public static java.awt.geom.Line2D[] getLines(java.awt.Shape shape, java.awt.geom.AffineTransform at) throws java.lang.IllegalArgumentException
Returns allline segments
building up ashape
.- Parameters:
shape
- a shape that is built up ofPathIterator.SEG_LINETO
elements.at
- an optionalAffineTransform
to be applied to the coordinates as they are returned in the iteration, ornull
if untransformed coordinates are desired- Returns:
- all
line segments
building up theshape
- Throws:
java.lang.IllegalArgumentException
- ifshape
contains non-straight line segments (i.e.PathIterator.SEG_CUBICTO
orPathIterator.SEG_QUADTO
)
-
-