Package org.eclipse.gef.geometry.planar
Class CubicCurve
java.lang.Object
org.eclipse.gef.geometry.planar.BezierCurve
org.eclipse.gef.geometry.planar.CubicCurve
- All Implemented Interfaces:
Serializable,Cloneable,ICurve,IGeometry,IRotatable<BezierCurve>,IScalable<BezierCurve>,ITranslatable<BezierCurve>
An instance of the
CubicCurve class represents a BezierCurve
of degree 3, having a start and an end Point and two handle
Points.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCubicCurve(double... coordinates) Constructs a newCubicCurveobject with the given sequence of x and y coordinates of the startPoint, the two handlePoints, and the endPoint.CubicCurve(double x1, double y1, double ctrl1X, double ctrl1Y, double ctrl2X, double ctrl2Y, double x2, double y2) Constructs a newCubicCurveobject from the given controlPointcoordinates.CubicCurve(Point... points) Constructs a newCubicCurvefrom the given sequence ofPoints, which is expected to be in the order: startPoint, first and second handlePoints, and endPoint.CubicCurve(Point start, Point ctrl1, Point ctrl2, Point end) Constructs a newCubicCurveobject from the given controlPoints. -
Method Summary
Modifier and TypeMethodDescriptionclone()Overridden with public visibility as recommended withinCloneable.getCopy()Returns a newCubicCurve, which has the same controlPoints as this one.getCtrl1()Returns the first handlePoint.getCtrl2()Returns the second handlePoint.doubleReturns the first handlePoint's x coordinate.doubleReturns the second handlePoint's x coordinate.doubleReturns the first handlePoint's y coordinate.doubleReturns the second handlePoint's y coordinate.final inthashCode()setCtrl1X(double ctrl1x) Sets the x coordinate of the first handlePointof thisCubicCurveto the given value.setCtrl1Y(double ctrl1y) Sets the y coordinate of the first handlePointof thisCubicCurveto the given value.setCtrl2X(double ctrl2x) Sets the x coordinate of the second handlePointof thisCubicCurveto the given value.setCtrl2Y(double ctrl2y) Sets the y coordinate of the second handlePointof thisCubicCurveto the given value.split(double t) Subdivides thisBezierCurveat the given parameter value t into two newBezierCurves.toPath()toString()booleanMethods inherited from class org.eclipse.gef.geometry.planar.BezierCurve
contains, contains, equals, get, getBounds, getClipped, getControlBounds, getDerivative, getElevated, getIntersections, getIntersections, getOffset, getOverlap, getOverlaps, getP1, getP2, getParameterAt, getPoint, getPoints, getProjection, getRotatedCCW, getRotatedCCW, getRotatedCCW, getRotatedCW, getRotatedCW, getRotatedCW, getScaled, getScaled, getScaled, getScaled, getScaled, getScaled, getTranslated, getTranslated, getX1, getX2, getY1, getY2, intersects, overlaps, overlaps, rotateCCW, rotateCCW, rotateCCW, rotateCW, rotateCW, rotateCW, scale, scale, scale, scale, scale, scale, setP1, setP2, setPoint, toBezier, toCubic, toLine, toLineStrip, toLineStrip, toPoints, toQuadratic, translate, translate
-
Constructor Details
-
CubicCurve
public CubicCurve(double... coordinates) Constructs a newCubicCurveobject with the given sequence of x and y coordinates of the startPoint, the two handlePoints, and the endPoint.- Parameters:
coordinates- the sequence of x and y coordinates specifying thisCubicCurve's controlPoints- See Also:
-
CubicCurve
public CubicCurve(double x1, double y1, double ctrl1X, double ctrl1Y, double ctrl2X, double ctrl2Y, double x2, double y2) Constructs a newCubicCurveobject from the given controlPointcoordinates.- Parameters:
x1- the x coordinate of the startPointy1- the y coordinate of the startPointctrl1X- the x coordinate of the first handlePointctrl1Y- the y coordinate of the first handlePointctrl2X- the x coordinate of the second handlePointctrl2Y- the y coordinate of the second handlePointx2- the x coordinate of the endPointy2- the y coordinate of the endPoint
-
CubicCurve
Constructs a newCubicCurvefrom the given sequence ofPoints, which is expected to be in the order: startPoint, first and second handlePoints, and endPoint.- Parameters:
points- the sequence ofPoints from which thisCubicCurveis constructed- See Also:
-
CubicCurve
Constructs a newCubicCurveobject from the given controlPoints.
-
-
Method Details
-
getCopy
Returns a newCubicCurve, which has the same controlPoints as this one.- Specified by:
getCopyin interfaceIGeometry- Overrides:
getCopyin classBezierCurve- Returns:
- a new
CubicCurvewith the same controlPoints as this one
-
getCtrl1
Returns the first handlePoint.- Returns:
- the first handle
Point
-
getCtrl2
Returns the second handlePoint.- Returns:
- the second handle
Point
-
getCtrlX1
public double getCtrlX1()Returns the first handlePoint's x coordinate.- Returns:
- the first handle
Point's x coordinate
-
getCtrlX2
public double getCtrlX2()Returns the second handlePoint's x coordinate.- Returns:
- the second handle
Point's x coordinate
-
getCtrlY1
public double getCtrlY1()Returns the first handlePoint's y coordinate.- Returns:
- the first handle
Point's y coordinate
-
getCtrlY2
public double getCtrlY2()Returns the second handlePoint's y coordinate.- Returns:
- the second handle
Point's y coordinate
-
getTransformed
Default implementation returning a transformedPathrepresentation of thisIGeometry. Subclasses may override this method to return a more specific representation.- Specified by:
getTransformedin interfaceIGeometry- Overrides:
getTransformedin classBezierCurve- Parameters:
t- TheAffineTransformto be applied- Returns:
- a transformed
Pathrepresentation of thisIGeometry - See Also:
-
setCtrl1
- Parameters:
ctrl1- the new first handlePoint- Returns:
thisfor convenience
-
setCtrl1X
Sets the x coordinate of the first handlePointof thisCubicCurveto the given value.- Parameters:
ctrl1x- the new x coordinate of the first handlePointof thisCubicCurve- Returns:
thisfor convenience
-
setCtrl1Y
Sets the y coordinate of the first handlePointof thisCubicCurveto the given value.- Parameters:
ctrl1y- the new y coordinate of the first handlePointof thisCubicCurve- Returns:
thisfor convenience
-
setCtrl2
- Parameters:
ctrl2- the new second handlePointof thisCubicCurve- Returns:
thisfor convenience
-
setCtrl2X
Sets the x coordinate of the second handlePointof thisCubicCurveto the given value.- Parameters:
ctrl2x- the new x coordinate of the second handlePointof thisCubicCurve- Returns:
thisfor convenience
-
setCtrl2Y
Sets the y coordinate of the second handlePointof thisCubicCurveto the given value.- Parameters:
ctrl2y- the new y coordinate of the second handlePointof thisCubicCurve- Returns:
thisfor convenience
-
setCurve
-
split
Description copied from class:BezierCurveSubdivides thisBezierCurveat the given parameter value t into two newBezierCurves. The first one is theBezierCurveover the parameterBezierCurve.Interval[0;t]and the second one is theBezierCurveover the parameterBezierCurve.Interval[t;1].- Overrides:
splitin classBezierCurve- Parameters:
t- the parameter value at which thisBezierCurveis subdivided- Returns:
- an array of two
BezierCurves, the left ([0;t]) and the right ([t;1])
-
toPath
Description copied from class:BezierCurve- Specified by:
toPathin interfaceIGeometry- Overrides:
toPathin classBezierCurve- Returns:
- a
Pathapproximating thisBezierCurveusingLinesegments
-
toString
- Overrides:
toStringin classBezierCurve
-
clone
Overridden with public visibility as recommended withinCloneable. -
hashCode
public final int hashCode() -
touches
Description copied from interface:IGeometry
-