public class PolyBezier extends java.lang.Object implements ICurve, ITranslatable<PolyBezier>, IScalable<PolyBezier>, IRotatable<PolyBezier>
| Modifier and Type | Field and Description |
|---|---|
static double |
INTERPOLATION_CURVE_WIDTH_COEFFICIENT
The default curve width coefficient used in interpolateCubic(...)
|
| Constructor and Description |
|---|
PolyBezier(BezierCurve... beziers)
Constructs a new
PolyBezier of the given BezierCurves. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Overridden with public visibility as recommended within
Cloneable
. |
boolean |
contains(Point p)
|
Rectangle |
getBounds()
|
PolyBezier |
getCopy()
Returns a new identical copy of this
IGeometry. |
Point[] |
getIntersections(ICurve c)
|
ICurve[] |
getOverlaps(ICurve c)
|
Point |
getP1()
|
Point |
getP2()
|
Point |
getProjection(Point reference)
|
PolyBezier |
getRotatedCCW(Angle angle)
|
PolyBezier |
getRotatedCCW(Angle angle,
double cx,
double cy)
|
PolyBezier |
getRotatedCCW(Angle angle,
Point center)
|
PolyBezier |
getRotatedCW(Angle angle)
|
PolyBezier |
getRotatedCW(Angle angle,
double cx,
double cy)
|
PolyBezier |
getRotatedCW(Angle angle,
Point center)
|
PolyBezier |
getScaled(double factor)
Scales a copy of the calling object by the given factor relative to its
center
Point. |
PolyBezier |
getScaled(double fx,
double fy)
Scales a copy of the calling object by the given factors relative to its
center
Point. |
PolyBezier |
getScaled(double factor,
double cx,
double cy)
Scales a copy of the calling object by the given factor relative to the
given center
Point (cx, cy). |
PolyBezier |
getScaled(double fx,
double fy,
double cx,
double cy)
Scales a copy of the calling object by the given factors relative to the
given center
Point (cx, cy). |
PolyBezier |
getScaled(double fx,
double fy,
Point center)
Scales a copy of the calling object by the given factors relative to the
given center
Point. |
PolyBezier |
getScaled(double factor,
Point center)
Scales a copy of the calling object by the given factor relative to the
given center
Point. |
PolyBezier |
getTransformed(AffineTransform t)
|
PolyBezier |
getTranslated(double dx,
double dy)
Translates a copy of this object by the given values in x and y
direction.
|
PolyBezier |
getTranslated(Point d)
Translates a copy of this object by the given
Point. |
double |
getX1()
Returns the start
Point's x coordinate. |
double |
getX2()
Returns the end
Point's x coordinate. |
double |
getY1()
Returns the start
Point's y coordinate. |
double |
getY2()
Returns the end
Point's y coordinate. |
int |
hashCode() |
static PolyBezier |
interpolateCubic(Angle startAngle,
double startLength,
Angle endAngle,
double endLength,
double curveWidthCoefficient,
Point... wayPoints)
|
static PolyBezier |
interpolateCubic(double... coordinates)
|
static PolyBezier |
interpolateCubic(double curveWidthCoefficient,
Point... points)
|
static PolyBezier |
interpolateCubic(Point... points) |
boolean |
intersects(ICurve c)
|
boolean |
overlaps(ICurve c)
|
PolyBezier |
rotateCCW(Angle angle)
|
PolyBezier |
rotateCCW(Angle angle,
double cx,
double cy)
Directly rotates this
PolyBezier counter-clock-wise around the
given point (specified by cx and cy) by the given Angle. |
PolyBezier |
rotateCCW(Angle angle,
Point center)
|
PolyBezier |
rotateCW(Angle angle)
|
PolyBezier |
rotateCW(Angle angle,
double cx,
double cy)
Directly rotates this
PolyBezier clock-wise around the given
point (specified by cx and cy) by the given Angle. |
PolyBezier |
rotateCW(Angle angle,
Point center)
|
PolyBezier |
scale(double factor)
Scales the calling object by the given factor relative to its center
Point. |
PolyBezier |
scale(double fx,
double fy)
Scales the calling object by the given factors relative to the given
center
Point. |
PolyBezier |
scale(double factor,
double cx,
double cy)
Scales the calling object by the given factor relative to the given
center
Point (cx, cy). |
PolyBezier |
scale(double fx,
double fy,
double cx,
double cy)
Scales the calling object by the given factors relative to the given
center
Point (cx, cy). |
PolyBezier |
scale(double fx,
double fy,
Point center)
Scales the calling object by the given factors relative to the given
center
Point. |
PolyBezier |
scale(double factor,
Point center)
Scales the calling object by the given factor relative to the given
center
Point. |
BezierCurve[] |
toBezier()
Computes a list of
BezierCurves that approximate the
ICurve. |
Path |
toPath()
|
java.lang.String |
toString() |
boolean |
touches(IGeometry g)
|
PolyBezier |
translate(double dx,
double dy)
Translates the object by the given values in x and y direction.
|
PolyBezier |
translate(Point d)
Translates the object by the given
Point. |
public static final double INTERPOLATION_CURVE_WIDTH_COEFFICIENT
public PolyBezier(BezierCurve... beziers)
PolyBezier of the given BezierCurves.
The BezierCurves are expected to be connected with each other.beziers - the BezierCurves which will constitute this
PolyBezierpublic static PolyBezier interpolateCubic(Angle startAngle, double startLength, Angle endAngle, double endLength, double curveWidthCoefficient, Point... wayPoints)
Creates a PolyBezier consisting of continuous CubicCurve
segments through the given Points.
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.
startAngle - start direction of the curvestartLength - length of the straight start segment of the curveendAngle - end direction of the curveendLength - length of the straight end segment of the curvecurveWidthCoefficient - 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.PolyBezier consisting of continuous CubicCurve
segments through the given Pointspublic static PolyBezier interpolateCubic(double... coordinates)
coordinates - the coordinates of the points that are to be interpolated.PolyBezier with continuous CubicCurve segments
through the points, specified via the given coordinates.interpolateCubic(Point...)public static PolyBezier interpolateCubic(double curveWidthCoefficient, Point... points)
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.PolyBezier with continuous CubicCurve segments
through the given Points.public static PolyBezier interpolateCubic(Point... points)
points - The array of Points which lie on the resulting
PolyBezier.PolyBezier with continuous CubicCurve segments
through the given Points.interpolateCubic(double, Point...)public PolyBezier getCopy()
IGeometryIGeometry.public Point[] getIntersections(ICurve c)
ICurvegetIntersections in interface ICurvec - The ICurve to compute intersection points with.public ICurve[] getOverlaps(ICurve c)
ICurvegetOverlaps in interface ICurvec - The curve to compute overlaps with.public Point getProjection(Point reference)
ICurvePoint onto
this ICurve, i.e. a Point on this ICurve that is
closest to the given reference Point. Note, thatgetProjection in interface ICurvereference - The reference Point for which to return the
projection.Point onto
this ICurve.public PolyBezier getRotatedCCW(Angle angle)
IRotatableAngle counter-clock-wise
(CCW) around its center Point. Does not necessarily return an
object of the same type.getRotatedCCW in interface IRotatable<PolyBezier>angle - rotation AngleIGeometry representing the result of the rotationpublic PolyBezier getRotatedCCW(Angle angle, double cx, double cy)
IRotatableAngle
counter-clock-wise (CCW) around the specified center Point (cx,
cy). Does not necessarily return an object of the same type.getRotatedCCW in interface IRotatable<PolyBezier>angle - rotation Anglecx - x-coordinate of the relative Point for the rotationcy - y-coordinate of the relative Point for the rotationIGeometry representing the result of the rotationpublic PolyBezier getRotatedCCW(Angle angle, Point center)
IRotatableAngle
counter-clock-wise (CCW) around the specified center Point. Does
not necessarily return an object of the same type.getRotatedCCW in interface IRotatable<PolyBezier>angle - rotation Anglecenter - relative Point for the rotationIGeometry representing the result of the rotationpublic PolyBezier getRotatedCW(Angle angle)
IRotatableAngle clock-wise (CW)
around its center Point. Does not necessarily return an object of
the same type.getRotatedCW in interface IRotatable<PolyBezier>angle - rotation AngleIGeometry representing the result of the rotationpublic PolyBezier getRotatedCW(Angle angle, double cx, double cy)
IRotatableAngle clock-wise (CW)
around the specified center Point (cx, cy). Does not necessarily
return an object of the same type.getRotatedCW in interface IRotatable<PolyBezier>angle - rotation Anglecx - x-coordinate of the relative Point for the rotationcy - y-coordinate of the relative Point for the rotationIGeometry representing the result of the rotationpublic PolyBezier getRotatedCW(Angle angle, Point center)
IRotatableAngle clock-wise (CW)
around the specified center Point. Does not necessarily return an
object of the same type.getRotatedCW in interface IRotatable<PolyBezier>angle - rotation Anglecenter - relative Point for the rotationIGeometry representing the result of the rotationpublic PolyBezier getScaled(double factor)
IScalablePoint.getScaled in interface IScalable<PolyBezier>factor - scale-factorpublic PolyBezier getScaled(double fx, double fy)
IScalablePoint.getScaled in interface IScalable<PolyBezier>fx - x-scale-factorfy - y-scale-factorpublic PolyBezier getScaled(double factor, double cx, double cy)
IScalablePoint (cx, cy).getScaled in interface IScalable<PolyBezier>factor - scale-factorcx - x-coordinate of the relative Point for the scalingcy - y-coordinate of the relative Point for the scalingpublic PolyBezier getScaled(double fx, double fy, double cx, double cy)
IScalablePoint (cx, cy).getScaled in interface IScalable<PolyBezier>fx - x-scale-factorfy - y-scale-factorcx - x-coordinate of the relative Point for the scalingcy - y-coordinate of the relative Point for the scalingpublic PolyBezier getScaled(double fx, double fy, Point center)
IScalablePoint.getScaled in interface IScalable<PolyBezier>fx - x-scale-factorfy - y-scale-factorcenter - relative Point for the scalingpublic PolyBezier getScaled(double factor, Point center)
IScalablePoint.getScaled in interface IScalable<PolyBezier>factor - scale-factorcenter - relative Point for the scalingpublic PolyBezier getTransformed(AffineTransform t)
Path
representation of this IGeometry. Subclasses may override this
method to return a more specific representation.getTransformed in interface IGeometryt - The AffineTransform to be appliedPath representation of this
IGeometrypublic PolyBezier getTranslated(double dx, double dy)
ITranslatablegetTranslated in interface ITranslatable<PolyBezier>dx - x-translationdy - y-translationpublic PolyBezier getTranslated(Point d)
ITranslatablePoint.getTranslated in interface ITranslatable<PolyBezier>d - translation Pointpublic double getX1()
ICurvePoint's x coordinate.public double getX2()
ICurvePoint's x coordinate.public double getY1()
ICurvePoint's y coordinate.public double getY2()
ICurvePoint's y coordinate.public boolean intersects(ICurve c)
ICurveICurve and the given ICurve intersect, i.e.
whether a final set of intersection points exists. Two curves intersect
if they touch (see IGeometry.touches(IGeometry)) but do not
overlap (see ICurve.overlaps(ICurve)).intersects in interface ICurvec - The ICurve to test for intersections.true if they intersect, false otherwisepublic boolean overlaps(ICurve c)
ICurveICurve and the given ICurve overlap, i.e.
whether an infinite set of intersection points exists. Two curves overlap
if they touch (see IGeometry.touches(IGeometry)) but not
intersect (see ICurve.intersects(ICurve)).public PolyBezier rotateCCW(Angle angle)
PolyBezier counter-clock-wise around its
center Point by the given Angle. Direct adaptation means,
that this PolyBezier is modified in-place.angle - rotation Anglethis for conveniencepublic PolyBezier rotateCCW(Angle angle, double cx, double cy)
PolyBezier counter-clock-wise around the
given point (specified by cx and cy) by the given Angle. Direct
adaptation means, that this PolyBezier is modified
in-place.public PolyBezier rotateCCW(Angle angle, Point center)
PolyBezier counter-clock-wise around the
given Point by the given Angle. Direct adaptation means,
that this PolyBezier is modified in-place.public PolyBezier rotateCW(Angle angle)
PolyBezier clock-wise around its center
Point by the given Angle. Direct adaptation means, that
this PolyBezier is modified in-place.angle - rotation Anglethis for conveniencepublic PolyBezier rotateCW(Angle angle, double cx, double cy)
PolyBezier clock-wise around the given
point (specified by cx and cy) by the given Angle. Direct
adaptation means, that this PolyBezier is modified
in-place.public PolyBezier rotateCW(Angle angle, Point center)
PolyBezier clock-wise around the given
Point by the given Angle. Direct adaptation means, that
this PolyBezier is modified in-place.public PolyBezier scale(double factor)
IScalablePoint.scale in interface IScalable<PolyBezier>factor - scale-factorthis for conveniencepublic PolyBezier scale(double fx, double fy)
IScalablePoint.scale in interface IScalable<PolyBezier>fx - x-scale-factorfy - y-scale-factorthis for conveniencepublic PolyBezier scale(double factor, double cx, double cy)
IScalablePoint (cx, cy).scale in interface IScalable<PolyBezier>factor - scale-factorcx - x-coordinate of the relative Point for the scalingcy - y-coordinate of the relative Point for the scalingthis for conveniencepublic PolyBezier scale(double fx, double fy, double cx, double cy)
IScalablePoint (cx, cy).scale in interface IScalable<PolyBezier>fx - x-scale-factorfy - y-scale-factorcx - x-coordinate of the relative Point for the scalingcy - y-coordinate of the relative Point for the scalingthis for conveniencepublic PolyBezier scale(double fx, double fy, Point center)
IScalablePoint.scale in interface IScalable<PolyBezier>fx - x-scale-factorfy - y-scale-factorcenter - relative Point for the scalingthis for conveniencepublic PolyBezier scale(double factor, Point center)
IScalablePoint.scale in interface IScalable<PolyBezier>factor - scale-factorcenter - relative Point for the scalingthis for conveniencepublic BezierCurve[] toBezier()
ICurveBezierCurves that approximate the
ICurve. For example, a Line or a BezierCurve in
general could return a list with the curve itself as its only element.
But an Ellipse or an Arc may return a list of consecutive
BezierCurves which approximate the ICurve.toBezier in interface ICurveBezierCurves that approximate the
ICurvepublic java.lang.String toString()
toString in class java.lang.Objectpublic PolyBezier translate(double dx, double dy)
ITranslatabletranslate in interface ITranslatable<PolyBezier>dx - x-translationdy - y-translationthis for conveniencepublic PolyBezier translate(Point d)
ITranslatablePoint.translate in interface ITranslatable<PolyBezier>d - translation Pointthis for conveniencepublic java.lang.Object clone()
Cloneable
.clone in class java.lang.Objectpublic final int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()Copyright (c) 2014 itemis AG, and others. All rights reserved.