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
Point
s.- See Also:
-
Constructor Summary
ConstructorDescriptionCubicCurve
(double... coordinates) Constructs a newCubicCurve
object with the given sequence of x and y coordinates of the startPoint
, the two handlePoint
s, and the endPoint
.CubicCurve
(double x1, double y1, double ctrl1X, double ctrl1Y, double ctrl2X, double ctrl2Y, double x2, double y2) Constructs a newCubicCurve
object from the given controlPoint
coordinates.CubicCurve
(Point... points) Constructs a newCubicCurve
from the given sequence ofPoint
s, which is expected to be in the order: startPoint
, first and second handlePoint
s, and endPoint
.CubicCurve
(Point start, Point ctrl1, Point ctrl2, Point end) Constructs a newCubicCurve
object from the given controlPoint
s. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Overridden with public visibility as recommended withinCloneable
.getCopy()
Returns a newCubicCurve
, which has the same controlPoint
s as this one.getCtrl1()
Returns the first handlePoint
.getCtrl2()
Returns the second handlePoint
.double
Returns the first handlePoint
's x coordinate.double
Returns the second handlePoint
's x coordinate.double
Returns the first handlePoint
's y coordinate.double
Returns the second handlePoint
's y coordinate.final int
hashCode()
setCtrl1X
(double ctrl1x) Sets the x coordinate of the first handlePoint
of thisCubicCurve
to the given value.setCtrl1Y
(double ctrl1y) Sets the y coordinate of the first handlePoint
of thisCubicCurve
to the given value.setCtrl2X
(double ctrl2x) Sets the x coordinate of the second handlePoint
of thisCubicCurve
to the given value.setCtrl2Y
(double ctrl2y) Sets the y coordinate of the second handlePoint
of thisCubicCurve
to the given value.split
(double t) Subdivides thisBezierCurve
at the given parameter value t into two newBezierCurve
s.toPath()
toString()
boolean
Methods 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 newCubicCurve
object with the given sequence of x and y coordinates of the startPoint
, the two handlePoint
s, and the endPoint
.- Parameters:
coordinates
- the sequence of x and y coordinates specifying thisCubicCurve
's controlPoint
s- See Also:
-
CubicCurve
public CubicCurve(double x1, double y1, double ctrl1X, double ctrl1Y, double ctrl2X, double ctrl2Y, double x2, double y2) Constructs a newCubicCurve
object from the given controlPoint
coordinates.- Parameters:
x1
- the x coordinate of the startPoint
y1
- the y coordinate of the startPoint
ctrl1X
- the x coordinate of the first handlePoint
ctrl1Y
- the y coordinate of the first handlePoint
ctrl2X
- the x coordinate of the second handlePoint
ctrl2Y
- the y coordinate of the second handlePoint
x2
- the x coordinate of the endPoint
y2
- the y coordinate of the endPoint
-
CubicCurve
Constructs a newCubicCurve
from the given sequence ofPoint
s, which is expected to be in the order: startPoint
, first and second handlePoint
s, and endPoint
.- Parameters:
points
- the sequence ofPoint
s from which thisCubicCurve
is constructed- See Also:
-
CubicCurve
Constructs a newCubicCurve
object from the given controlPoint
s.
-
-
Method Details
-
getCopy
Returns a newCubicCurve
, which has the same controlPoint
s as this one.- Specified by:
getCopy
in interfaceIGeometry
- Overrides:
getCopy
in classBezierCurve
- Returns:
- a new
CubicCurve
with the same controlPoint
s 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 transformedPath
representation of thisIGeometry
. Subclasses may override this method to return a more specific representation.- Specified by:
getTransformed
in interfaceIGeometry
- Overrides:
getTransformed
in classBezierCurve
- Parameters:
t
- TheAffineTransform
to be applied- Returns:
- a transformed
Path
representation of thisIGeometry
- See Also:
-
setCtrl1
- Parameters:
ctrl1
- the new first handlePoint
- Returns:
this
for convenience
-
setCtrl1X
Sets the x coordinate of the first handlePoint
of thisCubicCurve
to the given value.- Parameters:
ctrl1x
- the new x coordinate of the first handlePoint
of thisCubicCurve
- Returns:
this
for convenience
-
setCtrl1Y
Sets the y coordinate of the first handlePoint
of thisCubicCurve
to the given value.- Parameters:
ctrl1y
- the new y coordinate of the first handlePoint
of thisCubicCurve
- Returns:
this
for convenience
-
setCtrl2
- Parameters:
ctrl2
- the new second handlePoint
of thisCubicCurve
- Returns:
this
for convenience
-
setCtrl2X
Sets the x coordinate of the second handlePoint
of thisCubicCurve
to the given value.- Parameters:
ctrl2x
- the new x coordinate of the second handlePoint
of thisCubicCurve
- Returns:
this
for convenience
-
setCtrl2Y
Sets the y coordinate of the second handlePoint
of thisCubicCurve
to the given value.- Parameters:
ctrl2y
- the new y coordinate of the second handlePoint
of thisCubicCurve
- Returns:
this
for convenience
-
setCurve
-
split
Description copied from class:BezierCurve
Subdivides thisBezierCurve
at the given parameter value t into two newBezierCurve
s. The first one is theBezierCurve
over the parameterBezierCurve.Interval
[0;t]
and the second one is theBezierCurve
over the parameterBezierCurve.Interval
[t;1]
.- Overrides:
split
in classBezierCurve
- Parameters:
t
- the parameter value at which thisBezierCurve
is subdivided- Returns:
- an array of two
BezierCurve
s, the left ([0;t]
) and the right ([t;1]
)
-
toPath
Description copied from class:BezierCurve
- Specified by:
toPath
in interfaceIGeometry
- Overrides:
toPath
in classBezierCurve
- Returns:
- a
Path
approximating thisBezierCurve
usingLine
segments
-
toString
- Overrides:
toString
in classBezierCurve
-
clone
Overridden with public visibility as recommended withinCloneable
. -
hashCode
public final int hashCode() -
touches
Description copied from interface:IGeometry
-