Package snap.geom
Class Path2DUtils
java.lang.Object
snap.geom.Path2DUtils
Utility methods for Path2D.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Path2D
addPathPointAtPoint
(Shape aPath, Point aPoint) Add a point to the curve by subdividing the path segment at the hit point.static Rect
getControlPointBoundsWithSelPointIndex
(Path2D aPath, int selPointIndex) Returns the bounds for all the control points.static int
handleAtPoint
(Path2D aPath, Point aPoint, int selPointIndex) Returns the handle index for a given point for given path.static boolean
isPointOnPath
(Path2D aPath, int pointIndex) Returns true of the point at pointIndex is on the path, and false if it is on the convex hull.static void
paintHandles
(Path2D aPath, Painter aPntr, int selPointIndex) Handles painting a path showing control point handles.static Path2D
removePointAtIndexSmoothly
(Shape aPath, int pointIndex) Delete the selected control point and readjust shape boundsstatic void
removeSegAtIndexSmoothly
(Path2D aPath, int anIndex) Removes the seg at given index, reconnecting the segs on either side of deleted seg.static Path2D
setPointSmoothly
(Shape aPath, int index, Point point) Resets the point at the given index to the given point, while preserving path smoothness.
-
Constructor Details
-
Path2DUtils
public Path2DUtils()
-
-
Method Details
-
paintHandles
Handles painting a path showing control point handles. -
setPointSmoothly
Resets the point at the given index to the given point, while preserving path smoothness. -
addPathPointAtPoint
Add a point to the curve by subdividing the path segment at the hit point. -
removePointAtIndexSmoothly
Delete the selected control point and readjust shape bounds -
removeSegAtIndexSmoothly
Removes the seg at given index, reconnecting the segs on either side of deleted seg. -
getControlPointBoundsWithSelPointIndex
Returns the bounds for all the control points. -
handleAtPoint
Returns the handle index for a given point for given path. Only returns points that are on the path, except for the control points of selected point (if not -1) -
isPointOnPath
Returns true of the point at pointIndex is on the path, and false if it is on the convex hull.
-