Documentation of 'de.erichseifert.gral.util.GeometryUtils' Java class
GeometryUtils
de.erichseifert.gral.util

Class GeometryUtils



  • public abstract class GeometryUtils
    extends java.lang.Object
    Abstract class that represents a collection of utility functions concerning geometry.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  GeometryUtils.PathSegment
      Utility data class for the values of the segments in a geometric shape.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static double EPSILON
      Precision.
      static double EPSILON_SQ
      Precision squared.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.util.List<GeometryUtils.PathSegment> getSegments(java.awt.Shape shape)
      Returns a list of a shape's segments as they are returned by its path iterator.
      static java.awt.Shape getShape(java.util.List<GeometryUtils.PathSegment> segments, boolean isDouble)
      Constructs a geometric shape from a list of path segments.
      static java.awt.geom.Area grow(java.awt.Shape s, double offset)
      Expand or shrink a shape in all directions by a defined offset.
      static java.awt.geom.Area grow(java.awt.Shape s, double offset, int join, float miterlimit)
      Expand or shrink a shape in all directions by a defined offset.
      static java.awt.geom.Point2D intersection(java.awt.geom.Line2D l1, java.awt.geom.Line2D l2)
      Returns the intersection point of two lines.
      static java.util.List<java.awt.geom.Point2D> intersection(java.awt.Shape s1, java.awt.Shape s2)
      Returns all intersection points of two shapes.
      static java.awt.geom.Area punch(java.awt.geom.Area shapeArea, double gap, boolean rounded, java.awt.geom.Point2D pointPos, java.awt.Shape pointShape)
      Subtract a specified geometric area of data points from another shape to yield gaps.
      static java.awt.Shape reverse(java.awt.Shape shape)
      Returns a clone of a specified shape which has a reversed order of the points, lines and curves.
      static java.awt.geom.Line2D[] shapeToLines(java.awt.Shape path, boolean swapped)
      Returns the line fragments of the specified Shape.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • shapeToLines

        public static java.awt.geom.Line2D[] shapeToLines(java.awt.Shape path,
                                                          boolean swapped)
        Returns the line fragments of the specified Shape.
        Parameters:
        path - Shape to be divided.
        swapped - Invert segment direction.
        Returns:
        Array of lines.
      • intersection

        public static java.util.List<java.awt.geom.Point2D> intersection(java.awt.Shape s1,
                                                                         java.awt.Shape s2)
        Returns all intersection points of two shapes.
        Parameters:
        s1 - First shape
        s2 - Second shape
        Returns:
        Intersection points, or empty array if no intersections were found
      • intersection

        public static java.awt.geom.Point2D intersection(java.awt.geom.Line2D l1,
                                                         java.awt.geom.Line2D l2)
        Returns the intersection point of two lines.
        Parameters:
        l1 - First line
        l2 - Second line
        Returns:
        Intersection point, or null if no intersection was found
      • grow

        public static java.awt.geom.Area grow(java.awt.Shape s,
                                              double offset)
        Expand or shrink a shape in all directions by a defined offset.
        Parameters:
        s - Shape
        offset - Offset
        Returns:
        New shape that was expanded or shrunk by the specified amount
      • grow

        public static java.awt.geom.Area grow(java.awt.Shape s,
                                              double offset,
                                              int join,
                                              float miterlimit)
        Expand or shrink a shape in all directions by a defined offset.
        Parameters:
        s - Shape
        offset - Offset to expand/shrink
        join - Method for handling edges (see BasicStroke)
        miterlimit - Limit for miter joining method
        Returns:
        New shape that is expanded or shrunk by the specified amount
      • punch

        public static java.awt.geom.Area punch(java.awt.geom.Area shapeArea,
                                               double gap,
                                               boolean rounded,
                                               java.awt.geom.Point2D pointPos,
                                               java.awt.Shape pointShape)
        Subtract a specified geometric area of data points from another shape to yield gaps.
        Parameters:
        shapeArea - Shape from which to subtract.
        gap - Size of the gap.
        rounded - Gap corners will be rounded if true.
        pointPos - Position of the data point
        pointShape - Shape of the data point
        Returns:
        Shape with punched holes
      • getSegments

        public static java.util.List<GeometryUtils.PathSegment> getSegments(java.awt.Shape shape)
        Returns a list of a shape's segments as they are returned by its path iterator.
        Parameters:
        shape - Shape to be iterated.
        Returns:
        A list of path segment objects.
      • getShape

        public static java.awt.Shape getShape(java.util.List<GeometryUtils.PathSegment> segments,
                                              boolean isDouble)
        Constructs a geometric shape from a list of path segments.
        Parameters:
        segments - List of path segments.
        isDouble - true if the shape contents should be stored with double values, false if they should be stored as float.
        Returns:
        A geometric shape.
      • reverse

        public static java.awt.Shape reverse(java.awt.Shape shape)
        Returns a clone of a specified shape which has a reversed order of the points, lines and curves.
        Parameters:
        shape - Original shape.
        Returns:
        Shape with reversed direction.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.