Package org.eclipse.gef.geometry.planar
Class PolyBezier
java.lang.Object
org.eclipse.gef.geometry.planar.PolyBezier
- All Implemented Interfaces:
- Serializable,- Cloneable,- ICurve,- IGeometry,- IRotatable<PolyBezier>,- IScalable<PolyBezier>,- ITranslatable<PolyBezier>
public class PolyBezier
extends Object
implements ICurve, ITranslatable<PolyBezier>, IScalable<PolyBezier>, IRotatable<PolyBezier>
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final doubleThe default curve width coefficient used in interpolateCubic(...)
- 
Constructor SummaryConstructorsConstructorDescriptionPolyBezier(BezierCurve... beziers) Constructs a newPolyBezierof the givenBezierCurves.
- 
Method SummaryModifier and TypeMethodDescriptionclone()Overridden with public visibility as recommended withinCloneable.booleanbooleangetCopy()Returns a new identical copy of thisIGeometry.Point[]ICurve[]getP1()getP2()getProjection(Point reference) getRotatedCCW(Angle angle) getRotatedCCW(Angle angle, double cx, double cy) getRotatedCCW(Angle angle, Point center) getRotatedCW(Angle angle) getRotatedCW(Angle angle, double cx, double cy) getRotatedCW(Angle angle, Point center) getScaled(double factor) Scales a copy of the calling object by the given factor relative to its centerPoint.getScaled(double fx, double fy) Scales a copy of the calling object by the given factors relative to its centerPoint.getScaled(double factor, double cx, double cy) Scales a copy of the calling object by the given factor relative to the given centerPoint(cx, cy).getScaled(double fx, double fy, double cx, double cy) Scales a copy of the calling object by the given factors relative to the given centerPoint(cx, cy).Scales a copy of the calling object by the given factors relative to the given centerPoint.Scales a copy of the calling object by the given factor relative to the given centerPoint.getTranslated(double dx, double dy) Translates a copy of this object by the given values in x and y direction.Translates a copy of this object by the givenPoint.doublegetX1()Returns the startPoint's x coordinate.doublegetX2()Returns the endPoint's x coordinate.doublegetY1()Returns the startPoint's y coordinate.doublegetY2()Returns the endPoint's y coordinate.final inthashCode()static PolyBezierinterpolateCubic(double... coordinates) static PolyBezierinterpolateCubic(double curveWidthCoefficient, Point... points) static PolyBezierinterpolateCubic(Angle startAngle, double startLength, Angle endAngle, double endLength, double curveWidthCoefficient, Point... wayPoints) static PolyBezierinterpolateCubic(Point... points) booleanintersects(ICurve c) booleanDirectly rotates thisPolyBeziercounter-clock-wise around the given point (specified by cx and cy) by the givenAngle.Directly rotates thisPolyBezierclock-wise around the given point (specified by cx and cy) by the givenAngle.scale(double factor) Scales the calling object by the given factor relative to its centerPoint.scale(double fx, double fy) Scales the calling object by the given factors relative to the given centerPoint.scale(double factor, double cx, double cy) Scales the calling object by the given factor relative to the given centerPoint(cx, cy).scale(double fx, double fy, double cx, double cy) Scales the calling object by the given factors relative to the given centerPoint(cx, cy).Scales the calling object by the given factors relative to the given centerPoint.Scales the calling object by the given factor relative to the given centerPoint.toBezier()Computes a list ofBezierCurves that approximate theICurve.toPath()toString()booleantranslate(double dx, double dy) Translates the object by the given values in x and y direction.Translates the object by the givenPoint.
- 
Field Details- 
INTERPOLATION_CURVE_WIDTH_COEFFICIENTpublic static final double INTERPOLATION_CURVE_WIDTH_COEFFICIENTThe default curve width coefficient used in interpolateCubic(...) methods.- See Also:
 
 
- 
- 
Constructor Details- 
PolyBezierConstructs a newPolyBezierof the givenBezierCurves. TheBezierCurves are expected to be connected with each other.- Parameters:
- beziers- the- BezierCurves which will constitute this- PolyBezier
 
 
- 
- 
Method Details- 
interpolateCubicpublic static PolyBezier interpolateCubic(Angle startAngle, double startLength, Angle endAngle, double endLength, double curveWidthCoefficient, Point... wayPoints) Creates a PolyBezierconsisting of continuousCubicCurvesegments through the givenPoints.The start angle and start length constrain the curve. Way points are added to assure the curve starts off with a straight line of said length in the direction specified by said angle. The end angle and end length constrain the curve. Way points are added to assure the curve ends in a straight line of said length in the direction specified by said angle. - Parameters:
- startAngle- start direction of the curve
- startLength- length of the straight start segment of the curve
- endAngle- end direction of the curve
- endLength- length of the straight end segment of the curve
- curveWidthCoefficient- value in the range- ]0;+Inf[that adjusts the width of the curve. A value smaller than 1 sharpens the curve and a value greater than 1 thickens the curve.
- wayPoints- The array of- Points which lie on the resulting- PolyBezier.
- Returns:
- PolyBezierconsisting of continuous- CubicCurvesegments through the given- Points
 
- 
interpolateCubic- Parameters:
- coordinates- the coordinates of the points that are to be interpolated.
- Returns:
- PolyBezierwith continuous- CubicCurvesegments through the points, specified via the given coordinates.
- See Also:
 
- 
interpolateCubic- Parameters:
- curveWidthCoefficient- value in the range- ]0;+Inf[that adjusts the width of the curve. A value smaller than one sharpens the curve and a value greater than one thickens the curve.
- points- The array of- Points which lie on the resulting- PolyBezier.
- Returns:
- PolyBezierwith continuous- CubicCurvesegments through the given- Points.
 
- 
interpolateCubic- Parameters:
- points- The array of- Points which lie on the resulting- PolyBezier.
- Returns:
- PolyBezierwith continuous- CubicCurvesegments through the given- Points.
- See Also:
 
- 
containsDescription copied from interface:IGeometry
- 
equals
- 
getBoundsDescription copied from interface:IGeometry
- 
getCopyDescription copied from interface:IGeometryReturns a new identical copy of thisIGeometry.
- 
getIntersectionsDescription copied from interface:ICurve- Specified by:
- getIntersectionsin interface- ICurve
- Parameters:
- c- The- ICurveto compute intersection points with.
- Returns:
- The points of intersection.
 
- 
getOverlapsDescription copied from interface:ICurve- Specified by:
- getOverlapsin interface- ICurve
- Parameters:
- c- The curve to compute overlaps with.
- Returns:
- The segments where both curves overlap.
 
- 
getP1Description copied from interface:ICurve
- 
getP2Description copied from interface:ICurve
- 
getProjectionDescription copied from interface:ICurveReturns a projection of the given referencePointonto thisICurve, i.e. aPointon thisICurvethat is closest to the given referencePoint. Note, that- Specified by:
- getProjectionin interface- ICurve
- Parameters:
- reference- The reference- Pointfor which to return the projection.
- Returns:
- The projection of the given reference Pointonto thisICurve.
 
- 
getRotatedCCWDescription copied from interface:IRotatableRotates the calling object by specifiedAnglecounter-clock-wise (CCW) around its centerPoint. Does not necessarily return an object of the same type.- Specified by:
- getRotatedCCWin interface- IRotatable<PolyBezier>
- Parameters:
- angle- rotation- Angle
- Returns:
- an IGeometryrepresenting the result of the rotation
 
- 
getRotatedCCWDescription copied from interface:IRotatableRotates the calling object by the specifiedAnglecounter-clock-wise (CCW) around the specified centerPoint(cx, cy). Does not necessarily return an object of the same type.- Specified by:
- getRotatedCCWin interface- IRotatable<PolyBezier>
- Parameters:
- angle- rotation- Angle
- cx- x-coordinate of the relative- Pointfor the rotation
- cy- y-coordinate of the relative- Pointfor the rotation
- Returns:
- an IGeometryrepresenting the result of the rotation
 
- 
getRotatedCCWDescription copied from interface:IRotatableRotates the calling object by the specifiedAnglecounter-clock-wise (CCW) around the specified centerPoint. Does not necessarily return an object of the same type.- Specified by:
- getRotatedCCWin interface- IRotatable<PolyBezier>
- Parameters:
- angle- rotation- Angle
- center- relative- Pointfor the rotation
- Returns:
- an IGeometryrepresenting the result of the rotation
 
- 
getRotatedCWDescription copied from interface:IRotatableRotates the calling object by specifiedAngleclock-wise (CW) around its centerPoint. Does not necessarily return an object of the same type.- Specified by:
- getRotatedCWin interface- IRotatable<PolyBezier>
- Parameters:
- angle- rotation- Angle
- Returns:
- an IGeometryrepresenting the result of the rotation
 
- 
getRotatedCWDescription copied from interface:IRotatableRotates the calling object by the specifiedAngleclock-wise (CW) around the specified centerPoint(cx, cy). Does not necessarily return an object of the same type.- Specified by:
- getRotatedCWin interface- IRotatable<PolyBezier>
- Parameters:
- angle- rotation- Angle
- cx- x-coordinate of the relative- Pointfor the rotation
- cy- y-coordinate of the relative- Pointfor the rotation
- Returns:
- an IGeometryrepresenting the result of the rotation
 
- 
getRotatedCWDescription copied from interface:IRotatableRotates the calling object by the specifiedAngleclock-wise (CW) around the specified centerPoint. Does not necessarily return an object of the same type.- Specified by:
- getRotatedCWin interface- IRotatable<PolyBezier>
- Parameters:
- angle- rotation- Angle
- center- relative- Pointfor the rotation
- Returns:
- an IGeometryrepresenting the result of the rotation
 
- 
getScaledDescription copied from interface:IScalableScales a copy of the calling object by the given factor relative to its centerPoint.- Specified by:
- getScaledin interface- IScalable<PolyBezier>
- Parameters:
- factor- scale-factor
- Returns:
- the new, scaled object
 
- 
getScaledDescription copied from interface:IScalableScales a copy of the calling object by the given factors relative to its centerPoint.- Specified by:
- getScaledin interface- IScalable<PolyBezier>
- Parameters:
- fx- x-scale-factor
- fy- y-scale-factor
- Returns:
- the new, scaled object
 
- 
getScaledDescription copied from interface:IScalableScales a copy of the calling object by the given factor relative to the given centerPoint(cx, cy).- Specified by:
- getScaledin interface- IScalable<PolyBezier>
- Parameters:
- factor- scale-factor
- cx- x-coordinate of the relative- Pointfor the scaling
- cy- y-coordinate of the relative- Pointfor the scaling
- Returns:
- the new, scaled object
 
- 
getScaledDescription copied from interface:IScalableScales a copy of the calling object by the given factors relative to the given centerPoint(cx, cy).- Specified by:
- getScaledin interface- IScalable<PolyBezier>
- Parameters:
- fx- x-scale-factor
- fy- y-scale-factor
- cx- x-coordinate of the relative- Pointfor the scaling
- cy- y-coordinate of the relative- Pointfor the scaling
- Returns:
- the new, scaled object
 
- 
getScaledDescription copied from interface:IScalableScales a copy of the calling object by the given factors relative to the given centerPoint.- Specified by:
- getScaledin interface- IScalable<PolyBezier>
- Parameters:
- fx- x-scale-factor
- fy- y-scale-factor
- center- relative- Pointfor the scaling
- Returns:
- the new, scaled object
 
- 
getScaledDescription copied from interface:IScalableScales a copy of the calling object by the given factor relative to the given centerPoint.- Specified by:
- getScaledin interface- IScalable<PolyBezier>
- Parameters:
- factor- scale-factor
- center- relative- Pointfor the scaling
- Returns:
- the new, scaled object
 
- 
getTransformedDefault implementation returning a transformedPathrepresentation of thisIGeometry. Subclasses may override this method to return a more specific representation.- Specified by:
- getTransformedin interface- IGeometry
- Parameters:
- t- The- AffineTransformto be applied
- Returns:
- a transformed Pathrepresentation of thisIGeometry
 
- 
getTranslatedDescription copied from interface:ITranslatableTranslates a copy of this object by the given values in x and y direction.- Specified by:
- getTranslatedin interface- ITranslatable<PolyBezier>
- Parameters:
- dx- x-translation
- dy- y-translation
- Returns:
- a new, translated object
 
- 
getTranslatedDescription copied from interface:ITranslatableTranslates a copy of this object by the givenPoint.- Specified by:
- getTranslatedin interface- ITranslatable<PolyBezier>
- Parameters:
- d- translation- Point
- Returns:
- a new, translated object
 
- 
getX1public double getX1()Description copied from interface:ICurveReturns the startPoint's x coordinate.
- 
getX2public double getX2()Description copied from interface:ICurveReturns the endPoint's x coordinate.
- 
getY1public double getY1()Description copied from interface:ICurveReturns the startPoint's y coordinate.
- 
getY2public double getY2()Description copied from interface:ICurveReturns the endPoint's y coordinate.
- 
intersectsDescription copied from interface:ICurveTests if thisICurveand the givenICurveintersect, i.e. whether a final set of intersection points exists. Two curves intersect if they touch (seeIGeometry.touches(IGeometry)) but do not overlap (seeICurve.overlaps(ICurve)).- Specified by:
- intersectsin interface- ICurve
- Parameters:
- c- The- ICurveto test for intersections.
- Returns:
- trueif they intersect,- falseotherwise
 
- 
overlapsDescription copied from interface:ICurveTests if thisICurveand the givenICurveoverlap, i.e. whether an infinite set of intersection points exists. Two curves overlap if they touch (seeIGeometry.touches(IGeometry)) but not intersect (seeICurve.intersects(ICurve)).
- 
rotateCCWDirectly rotates thisPolyBeziercounter-clock-wise around its centerPointby the givenAngle. Direct adaptation means, thatthisPolyBezieris modified in-place.- Parameters:
- angle- rotation- Angle
- Returns:
- thisfor convenience
 
- 
rotateCCWDirectly rotates thisPolyBeziercounter-clock-wise around the given point (specified by cx and cy) by the givenAngle. Direct adaptation means, thatthisPolyBezieris modified in-place.
- 
rotateCCWDirectly rotates thisPolyBeziercounter-clock-wise around the givenPointby the givenAngle. Direct adaptation means, thatthisPolyBezieris modified in-place.
- 
rotateCWDirectly rotates thisPolyBezierclock-wise around its centerPointby the givenAngle. Direct adaptation means, thatthisPolyBezieris modified in-place.- Parameters:
- angle- rotation- Angle
- Returns:
- thisfor convenience
 
- 
rotateCWDirectly rotates thisPolyBezierclock-wise around the given point (specified by cx and cy) by the givenAngle. Direct adaptation means, thatthisPolyBezieris modified in-place.
- 
rotateCWDirectly rotates thisPolyBezierclock-wise around the givenPointby the givenAngle. Direct adaptation means, thatthisPolyBezieris modified in-place.
- 
scaleDescription copied from interface:IScalableScales the calling object by the given factor relative to its centerPoint.- Specified by:
- scalein interface- IScalable<PolyBezier>
- Parameters:
- factor- scale-factor
- Returns:
- thisfor convenience
 
- 
scaleDescription copied from interface:IScalableScales the calling object by the given factors relative to the given centerPoint.- Specified by:
- scalein interface- IScalable<PolyBezier>
- Parameters:
- fx- x-scale-factor
- fy- y-scale-factor
- Returns:
- thisfor convenience
 
- 
scaleDescription copied from interface:IScalableScales the calling object by the given factor relative to the given centerPoint(cx, cy).- Specified by:
- scalein interface- IScalable<PolyBezier>
- Parameters:
- factor- scale-factor
- cx- x-coordinate of the relative- Pointfor the scaling
- cy- y-coordinate of the relative- Pointfor the scaling
- Returns:
- thisfor convenience
 
- 
scaleDescription copied from interface:IScalableScales the calling object by the given factors relative to the given centerPoint(cx, cy).- Specified by:
- scalein interface- IScalable<PolyBezier>
- Parameters:
- fx- x-scale-factor
- fy- y-scale-factor
- cx- x-coordinate of the relative- Pointfor the scaling
- cy- y-coordinate of the relative- Pointfor the scaling
- Returns:
- thisfor convenience
 
- 
scaleDescription copied from interface:IScalableScales the calling object by the given factors relative to the given centerPoint.- Specified by:
- scalein interface- IScalable<PolyBezier>
- Parameters:
- fx- x-scale-factor
- fy- y-scale-factor
- center- relative- Pointfor the scaling
- Returns:
- thisfor convenience
 
- 
scaleDescription copied from interface:IScalableScales the calling object by the given factor relative to the given centerPoint.- Specified by:
- scalein interface- IScalable<PolyBezier>
- Parameters:
- factor- scale-factor
- center- relative- Pointfor the scaling
- Returns:
- thisfor convenience
 
- 
toBezierDescription copied from interface:ICurveComputes a list ofBezierCurves that approximate theICurve. For example, aLineor aBezierCurvein general could return a list with the curve itself as its only element. But anEllipseor anArcmay return a list of consecutiveBezierCurves which approximate theICurve.- Specified by:
- toBezierin interface- ICurve
- Returns:
- a list of BezierCurves that approximate theICurve
 
- 
toPathDescription copied from interface:IGeometry
- 
toString
- 
translateDescription copied from interface:ITranslatableTranslates the object by the given values in x and y direction.- Specified by:
- translatein interface- ITranslatable<PolyBezier>
- Parameters:
- dx- x-translation
- dy- y-translation
- Returns:
- thisfor convenience
 
- 
translateDescription copied from interface:ITranslatableTranslates the object by the givenPoint.- Specified by:
- translatein interface- ITranslatable<PolyBezier>
- Parameters:
- d- translation- Point
- Returns:
- thisfor convenience
 
- 
cloneOverridden with public visibility as recommended withinCloneable.
- 
hashCodepublic final int hashCode()
- 
touchesDescription copied from interface:IGeometry
 
-