Class RMBezier
java.lang.Object
com.inductiveautomation.rm.graphics.RMLine
com.inductiveautomation.rm.graphics.RMQuadratic
com.inductiveautomation.rm.graphics.RMBezier
- All Implemented Interfaces:
Cloneable
This class models a simple bezier curve, providing methods for extracting points, distance calculation, bisection,
hit detection and such.
-
Field Summary
FieldsFields inherited from class com.inductiveautomation.rm.graphics.RMQuadratic
_cp1
-
Constructor Summary
ConstructorsConstructorDescriptionRMBezier()
Creates a new bezier.RMBezier
(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) Creates a new bezier from the given start point, control points and end point.Creates a new bezier from the given start point, control points and end point. -
Method Summary
Modifier and TypeMethodDescriptionReturns an RMFunc which calculates the arclength of the curve up to t.static void
getBounds
(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3, Rectangle2D aRect) Returns the bounds of the bezier.void
getBounds
(Rectangle2D aRect) Returns the bounds.double
getDistance
(RMPoint aPoint) Returns the minimum distance from the given point to this segment.double
getDistanceBezier
(RMPoint aPoint) Returns the minimum distance from the given point to the curve.getHead
(double t) Returns a new line from this line's start point to given parametric location t (defined from 0-1) on this line.getHitInfo
(RMBezier aBezier) Returns a hit info for this bezier and given bezier.getHitInfo
(RMLine aLine) Returns the hit info for this bezier and a given line.double
getMaxX()
Returns the max x point of this bezier.double
getMaxY()
Returns the max y point of this bezier.double
getMinX()
Returns the min x point of this bezier.double
getMinY()
Returns the min y point of this bezier.Returns a specific point on the curve at the given parametric value (from 0-1).int
Returns the point count of segment.double
getPointX
(int anIndex) Returns the x of point at given index.double
getPointY
(int anIndex) Returns the y of point at given index.getTail
(double t) Returns a new line from given parametric location t (defined from 0-1) on this line to this line's end point.void
Sets the values of the curve.void
setEnd
(double t) Reset this curve's end point to the given parametric location (0-1).void
setStart
(double t) Reset this curve's start point to the given parametric location (0-1).void
Returns a bezier curve from this curve's start point to the given parametric location (0-1).toString()
Returns a string representation of this bezier.Methods inherited from class com.inductiveautomation.rm.graphics.RMQuadratic
getArcLength, getBounds, getDistanceQuadratic, getInverseArcLengthFunction, getParameterForLength, setCurve, setCurve, subdivide
Methods inherited from class com.inductiveautomation.rm.graphics.RMLine
clone, getAngle, getArcLength, getArcLength, getBounds, getDistanceLine, getDistanceLineSquared, getDistanceLineSquared, getHitInfo, getLastX, getLastY, getPoint, getTangent
-
Field Details
-
_cp2
-
-
Constructor Details
-
RMBezier
public RMBezier()Creates a new bezier. -
RMBezier
Creates a new bezier from the given start point, control points and end point. -
RMBezier
public RMBezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) Creates a new bezier from the given start point, control points and end point.
-
-
Method Details
-
setCurve
Sets the values of the curve. -
getPoint
Returns a specific point on the curve at the given parametric value (from 0-1).- Overrides:
getPoint
in classRMQuadratic
-
getPointCount
public int getPointCount()Returns the point count of segment.- Overrides:
getPointCount
in classRMQuadratic
-
getPointX
public double getPointX(int anIndex) Returns the x of point at given index.- Overrides:
getPointX
in classRMQuadratic
-
getPointY
public double getPointY(int anIndex) Returns the y of point at given index.- Overrides:
getPointY
in classRMQuadratic
-
getDistance
Returns the minimum distance from the given point to this segment.- Overrides:
getDistance
in classRMQuadratic
-
getDistanceBezier
Returns the minimum distance from the given point to the curve. -
getMinX
public double getMinX()Returns the min x point of this bezier.- Overrides:
getMinX
in classRMQuadratic
-
getMinY
public double getMinY()Returns the min y point of this bezier.- Overrides:
getMinY
in classRMQuadratic
-
getMaxX
public double getMaxX()Returns the max x point of this bezier.- Overrides:
getMaxX
in classRMQuadratic
-
getMaxY
public double getMaxY()Returns the max y point of this bezier.- Overrides:
getMaxY
in classRMQuadratic
-
getBounds
Returns the bounds.- Overrides:
getBounds
in classRMQuadratic
-
getBounds
public static void getBounds(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3, Rectangle2D aRect) Returns the bounds of the bezier. -
getHitInfo
Returns the hit info for this bezier and a given line.- Overrides:
getHitInfo
in classRMLine
-
getHitInfo
Returns a hit info for this bezier and given bezier.- Overrides:
getHitInfo
in classRMLine
-
getHead
Returns a new line from this line's start point to given parametric location t (defined from 0-1) on this line. -
getTail
Returns a new line from given parametric location t (defined from 0-1) on this line to this line's end point. -
subdivide
Returns a bezier curve from this curve's start point to the given parametric location (0-1). -
setEnd
public void setEnd(double t) Reset this curve's end point to the given parametric location (0-1). -
setStart
public void setStart(double t) Reset this curve's start point to the given parametric location (0-1). -
getArcLengthFunction
Returns an RMFunc which calculates the arclength of the curve up to t.- Overrides:
getArcLengthFunction
in classRMQuadratic
-
toString
Returns a string representation of this bezier.
-