Package kiyut.sketsa.util
Class GeomUtilities
- java.lang.Object
-
- kiyut.sketsa.util.GeomUtilities
-
public class GeomUtilities extends Object
Collection of Geometry Utilities- Author:
- KIYUT
-
-
Constructor Summary
Constructors Constructor Description GeomUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ShapecreateShape(String pathString)Return Shape for the supplied pathString that conform to SVG d attributestatic Rectangle2DgetBounds2D(List<Shape> shapeList)Return bounds for the supplied shapeListstatic intgetPathSegType(String type)static doublescaleToFit(Dimension src, Dimension dest)Return the scale value fromsrctodestproportionallystatic 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.
-
-
-
Method Detail
-
scaleToFit
public static double scaleToFit(Dimension src, Dimension dest)
Return the scale value fromsrctodestproportionally- Parameters:
src- source dimensiondest- 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 pixelpointList- List of Point2DsimplifyList- List of Point2D or null- Returns:
- simplifyList of Point2D
-
getPathSegType
public static int getPathSegType(String type)
-
-