Class GeomUtilities


  • public class GeomUtilities
    extends Object
    Collection of Geometry Utilities
    Author:
    KIYUT
    • Constructor Detail

      • GeomUtilities

        public GeomUtilities()
    • Method Detail

      • scaleToFit

        public static double scaleToFit​(Dimension src,
                                        Dimension dest)
        Return the scale value from src to dest proportionally
        Parameters:
        src - source dimension
        dest - destination dimension
        Returns:
        the scale value
      • getBounds2D

        public static Rectangle2D getBounds2D​(List<Shape> shapeList)
        Return bounds for the supplied shapeList
        Parameters:
        shapeList - List of Shape
        Returns:
        bounds for the supplied shapeList
      • createShape

        public static Shape createShape​(String pathString)
                                 throws IllegalArgumentException
        Return Shape for the supplied pathString that conform to SVG d attribute
        Parameters:
        pathString - String that conform to SVG d attribute
        Returns:
        Shape
        Throws:
        IllegalArgumentException - when parse fail
      • simplify

        public static List<Point2D> simplify​(double tol,
                                             List<Point2D> pointList,
                                             List<Point2D> simplifyList)
        Computes the simplified version of the pointList and approximation tolerance and stores on the simplifyList. If simplifyList is null a new List object is allocated.
        Parameters:
        tol - approximation tolerance in pixel
        pointList - List of Point2D
        simplifyList - List of Point2D or null
        Returns:
        simplifyList of Point2D
      • getPathSegType

        public static int getPathSegType​(String type)