Class RMPathUtils
java.lang.Object
com.inductiveautomation.rm.graphics.RMPathUtils
Some utility methods for RMPaths.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RMPath
appendOval
(RMPath aPath, RMRect aRect, float startAngle, float sweep, boolean connect) Adds elements describing an oval in the given rect to this path.static RMPath
appendShape
(RMPath aPath, Shape aShape) Returns a new path from an AWT shape.static double
getDistance
(RMPath aPath, RMPoint aPoint) Returns shortest distance from any point in path to given point.static double
getDistanceSigned
(RMPath aPath, RMPoint aPoint) Returns shortest distance from any point in path to given point (negative means inside the path).static RMPath
getPathFlattened
(RMPath aPath) Returns a path with only moveto, lineto.static RMPath
getPathWithFlattendCubics
(RMPath aPath) Returns a copy of the path with cubics demoted to one or more quadratics.static boolean
Returns whether the path has any cubic curves in it.static boolean
isPolygonal
(RMPath aPath) Returns whether path has any curve segments (QuadTo, CurveTo).static RMPath
Returns the combined paths from given paths.static void
quadraticCurveTo
(RMPath aPath, RMPoint cp1, RMPoint cp2, RMPoint aPoint) This is effectively a curveTo but does it internally with one or more approximated quadratics.
-
Field Details
-
JOIN_OP_ADD
public static final int JOIN_OP_ADD- See Also:
-
JOIN_OP_SUBTRACT
public static final int JOIN_OP_SUBTRACT- See Also:
-
JOIN_OP_INTERSECT
public static final int JOIN_OP_INTERSECT- See Also:
-
JOIN_OP_XOR
public static final int JOIN_OP_XOR- See Also:
-
-
Constructor Details
-
RMPathUtils
public RMPathUtils()
-
-
Method Details
-
appendShape
Returns a new path from an AWT shape. -
appendOval
public static RMPath appendOval(RMPath aPath, RMRect aRect, float startAngle, float sweep, boolean connect) Adds elements describing an oval in the given rect to this path. -
isPolygonal
Returns whether path has any curve segments (QuadTo, CurveTo). -
hasCubics
Returns whether the path has any cubic curves in it. -
getPathFlattened
Returns a path with only moveto, lineto. -
getPathWithFlattendCubics
Returns a copy of the path with cubics demoted to one or more quadratics. -
quadraticCurveTo
This is effectively a curveTo but does it internally with one or more approximated quadratics. I found a C++ version of this on http://homepages.tig.com.au/~dkl/swf/ - Jeff Martin. It illustrates how to approximate 4-point cubic Beziers with 3-point quadratic Beziers. PostScript (and most apps) use cubics, Flash uses quadratics. -
getDistance
Returns shortest distance from any point in path to given point. -
getDistanceSigned
Returns shortest distance from any point in path to given point (negative means inside the path). -
join
Returns the combined paths from given paths.
-