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 BezierCurve s. |
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
BezierCurve s 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 BezierCurve
s.
The BezierCurve
s are expected to be connected with each other.beziers
- the BezierCurve
s which will constitute this
PolyBezier
public 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 Point
s.
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 Point
s which lie on the resulting
PolyBezier
.PolyBezier
consisting of continuous CubicCurve
segments through the given Point
spublic 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 Point
s which lie on the resulting
PolyBezier
.PolyBezier
with continuous CubicCurve
segments
through the given Point
s.public static PolyBezier interpolateCubic(Point... points)
points
- The array of Point
s which lie on the resulting
PolyBezier
.PolyBezier
with continuous CubicCurve
segments
through the given Point
s.interpolateCubic(double, Point...)
public PolyBezier getCopy()
IGeometry
IGeometry
.public Point[] getIntersections(ICurve c)
ICurve
getIntersections
in interface ICurve
c
- The ICurve
to compute intersection points with.public ICurve[] getOverlaps(ICurve c)
ICurve
getOverlaps
in interface ICurve
c
- The curve to compute overlaps with.public Point getProjection(Point reference)
ICurve
Point
onto
this ICurve
, i.e. a Point
on this ICurve
that is
closest to the given reference Point
. Note, thatgetProjection
in interface ICurve
reference
- The reference Point
for which to return the
projection.Point
onto
this ICurve
.public PolyBezier getRotatedCCW(Angle angle)
IRotatable
Angle
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 Angle
IGeometry
representing the result of the rotationpublic PolyBezier getRotatedCCW(Angle angle, double cx, double cy)
IRotatable
Angle
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 Angle
cx
- 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)
IRotatable
Angle
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 Angle
center
- relative Point
for the rotationIGeometry
representing the result of the rotationpublic PolyBezier getRotatedCW(Angle angle)
IRotatable
Angle
clock-wise (CW)
around its center Point
. Does not necessarily return an object of
the same type.getRotatedCW
in interface IRotatable<PolyBezier>
angle
- rotation Angle
IGeometry
representing the result of the rotationpublic PolyBezier getRotatedCW(Angle angle, double cx, double cy)
IRotatable
Angle
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 Angle
cx
- 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)
IRotatable
Angle
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 Angle
center
- relative Point
for the rotationIGeometry
representing the result of the rotationpublic PolyBezier getScaled(double factor)
IScalable
Point
.getScaled
in interface IScalable<PolyBezier>
factor
- scale-factorpublic PolyBezier getScaled(double fx, double fy)
IScalable
Point
.getScaled
in interface IScalable<PolyBezier>
fx
- x-scale-factorfy
- y-scale-factorpublic PolyBezier getScaled(double factor, double cx, double cy)
IScalable
Point
(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)
IScalable
Point
(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)
IScalable
Point
.getScaled
in interface IScalable<PolyBezier>
fx
- x-scale-factorfy
- y-scale-factorcenter
- relative Point
for the scalingpublic PolyBezier getScaled(double factor, Point center)
IScalable
Point
.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 IGeometry
t
- The AffineTransform
to be appliedPath
representation of this
IGeometry
public PolyBezier getTranslated(double dx, double dy)
ITranslatable
getTranslated
in interface ITranslatable<PolyBezier>
dx
- x-translationdy
- y-translationpublic PolyBezier getTranslated(Point d)
ITranslatable
Point
.getTranslated
in interface ITranslatable<PolyBezier>
d
- translation Point
public double getX1()
ICurve
Point
's x coordinate.public double getX2()
ICurve
Point
's x coordinate.public double getY1()
ICurve
Point
's y coordinate.public double getY2()
ICurve
Point
's y coordinate.public boolean intersects(ICurve c)
ICurve
ICurve
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 ICurve
c
- The ICurve
to test for intersections.true
if they intersect, false
otherwisepublic boolean overlaps(ICurve c)
ICurve
ICurve
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 Angle
this
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 Angle
this
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)
IScalable
Point
.scale
in interface IScalable<PolyBezier>
factor
- scale-factorthis
for conveniencepublic PolyBezier scale(double fx, double fy)
IScalable
Point
.scale
in interface IScalable<PolyBezier>
fx
- x-scale-factorfy
- y-scale-factorthis
for conveniencepublic PolyBezier scale(double factor, double cx, double cy)
IScalable
Point
(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)
IScalable
Point
(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)
IScalable
Point
.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)
IScalable
Point
.scale
in interface IScalable<PolyBezier>
factor
- scale-factorcenter
- relative Point
for the scalingthis
for conveniencepublic BezierCurve[] toBezier()
ICurve
BezierCurve
s 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
BezierCurve
s which approximate the ICurve
.toBezier
in interface ICurve
BezierCurve
s that approximate the
ICurve
public java.lang.String toString()
toString
in class java.lang.Object
public PolyBezier translate(double dx, double dy)
ITranslatable
translate
in interface ITranslatable<PolyBezier>
dx
- x-translationdy
- y-translationthis
for conveniencepublic PolyBezier translate(Point d)
ITranslatable
Point
.translate
in interface ITranslatable<PolyBezier>
d
- translation Point
this
for conveniencepublic java.lang.Object clone()
Cloneable
.clone
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
Copyright (c) 2014 itemis AG, and others. All rights reserved.