java.lang.Object
org.jhotdraw8.geom.shape.BezierNode
Represents a node of a bezier path. A node has up to three control points:
- px,py: POINT is the point through which the curve passes.
- ix,iy: IN controls the tangent of the curve going towards C0.
- ox,oy: OUT controls the tangent of the curve going away from C0.
- Author:
- Werner Randelshofer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant for having control points C0 and C2 in effect.static final intConstant for closing the path by drawing a line or curve from this bezier node to the last node with aMOVE_MASK.static final intConstant for having control point C1 in effect (in addition to C0).static final intConstant for having control points C1 and C2 in effect.static final intConstant for moving to this bezier node.static final intConstant for having control point C2 in effect (in addition to C0).static final intConstant for having control points C0, C1 and C2 in effect.static final intConstant for having control point C0 in effectstatic final intConstant for having control points C0 and C1 in effect. -
Constructor Summary
ConstructorsConstructorDescriptionBezierNode(double pointX, double pointY) BezierNode(int mask, boolean equidistant, boolean collinear, double pointX, double pointY, double inX, double inY, double outX, double outY) BezierNode(int mask, boolean equidistant, boolean collinear, @NonNull Point2D p, @NonNull Point2D i, @NonNull Point2D o) BezierNode(@NonNull javafx.geometry.Point2D p) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanbooleangetC(int mask) Gets a control point given the specified mask.<T> @NonNull TgetC(int mask, @NonNull BiFunction<Double, Double, T> f) getIn()Gets the incoming tangent point.<T> @NonNull TgetIn(@NonNull BiFunction<Double, Double, T> f) Gets the incoming tangent point.intgetMask()doublegetMaxX()doublegetMaxY()doublegetMinX()doublegetMinY()getOut()Gets the outgoing tangent point.<T> @NonNull TgetOut(@NonNull BiFunction<Double, Double, T> f) Gets the outgoing tangent point.getPoint()Gets the point through which the curve passes.<T> @NonNull TgetPoint(@NonNull BiFunction<Double, Double, T> f) Gets the point through which the curve passes.doublegetX(int mask) Gets the x-coordinate of a control point given the specified mask.doublegetY(int mask) inthashCode()booleanhasIn()booleanhasMask(int probe) booleanhasMaskBits(int mask) booleanhasOut()doubleinX()doubleinY()booleanbooleanbooleanbooleanisMoveTo()doubleoutX()doubleoutY()doublepointX()doublepointY()toString()transform(@NonNull AffineTransform transform) withC(int mask, double x, double y) withCollinear(boolean collinear) withEquidistant(boolean equidistant) withIn(double inX, double inY) withIx(double ix) withIy(double iy) withMask(int mask) withMaskBitsClears(int mask) Clears all the bits in the specified mask.withMaskBitsSet(int mask) Sets all the bits in the specified mask.withOut(double outX, double outY) withOx(double ox) withOy(double oy) withPoint(double x0, double y0) withPointAndTranslatedInOut(@NonNull javafx.geometry.Point2D c0) withPointY(double py) withPx(double px)
-
Field Details
-
POINT_MASK
public static final int POINT_MASKConstant for having control point C0 in effect- See Also:
-
IN_MASK
public static final int IN_MASKConstant for having control point C1 in effect (in addition to C0). C1 controls the curve going towards C0.- See Also:
-
POINT_OUT_MASK
public static final int POINT_OUT_MASKConstant for having control points C0 and C1 in effect.- See Also:
-
OUT_MASK
public static final int OUT_MASKConstant for having control point C2 in effect (in addition to C0). C2 controls the curve going away from C0.- See Also:
-
IN_OUT_MASK
public static final int IN_OUT_MASKConstant for having control points C1 and C2 in effect.- See Also:
-
POINT_IN_OUT_MASK
public static final int POINT_IN_OUT_MASKConstant for having control points C0, C1 and C2 in effect.- See Also:
-
C0C2_MASK
public static final int C0C2_MASKConstant for having control points C0 and C2 in effect.- See Also:
-
MOVE_MASK
public static final int MOVE_MASKConstant for moving to this bezier node.- See Also:
-
CLOSE_MASK
public static final int CLOSE_MASKConstant for closing the path by drawing a line or curve from this bezier node to the last node with aMOVE_MASK.- See Also:
-
-
Constructor Details
-
BezierNode
public BezierNode(double pointX, double pointY) -
BezierNode
-
BezierNode
-
BezierNode
-
BezierNode
public BezierNode(int mask, boolean equidistant, boolean collinear, double pointX, double pointY, double inX, double inY, double outX, double outY)
-
-
Method Details
-
computeIsCollinear
public boolean computeIsCollinear() -
computeIsEquidistant
public boolean computeIsEquidistant() -
equals
-
getC
Gets a control point given the specified mask.- Parameters:
mask- a mask, one ofPOINT_MASK,IN_MASK,OUT_MASK.- Returns:
- the point
-
getC
-
getPoint
Gets the point through which the curve passes.- Returns:
- curve point
-
getIn
Gets the incoming tangent point.- Returns:
- incoming tangent point
-
getOut
Gets the outgoing tangent point.- Returns:
- outgoing tangent point
-
getPoint
Gets the point through which the curve passes.- Returns:
- curve point
-
getIn
Gets the incoming tangent point.- Returns:
- incoming tangent point
-
getOut
Gets the outgoing tangent point.- Returns:
- outgoing tangent point
-
getMask
public int getMask()- Returns:
- the mask
-
hasMask
public boolean hasMask(int probe) -
getMaxX
public double getMaxX() -
getMaxY
public double getMaxY() -
getMinX
public double getMinX() -
getMinY
public double getMinY() -
getX
public double getX(int mask) Gets the x-coordinate of a control point given the specified mask.- Parameters:
mask- a mask, one ofPOINT_MASK,IN_MASK,OUT_MASK.- Returns:
- the point
-
pointX
public double pointX()- Returns:
- the px
-
withPx
- Parameters:
px- the p to set- Returns:
- a new instance
-
inX
public double inX()- Returns:
- the ix
-
withIx
- Parameters:
ix- the x1 to set- Returns:
- a new instance
-
outX
public double outX()- Returns:
- the x2
-
withOx
- Parameters:
ox- the x2 to set- Returns:
- a new instance
-
getY
public double getY(int mask) -
pointY
public double pointY()- Returns:
- the y0
-
withPointY
- Parameters:
py- the y0 to set- Returns:
- a new instance
-
inY
public double inY()- Returns:
- the y1
-
withIy
- Parameters:
iy- the y1 to set- Returns:
- a new instance
-
outY
public double outY()- Returns:
- the y2
-
withOy
- Parameters:
oy- the y2 to set- Returns:
- a new instance
-
hashCode
public int hashCode() -
hasMaskBits
public boolean hasMaskBits(int mask) -
hasIn
public boolean hasIn() -
hasOut
public boolean hasOut() -
isCollinear
public boolean isCollinear()- Returns:
- the collinear
-
isEquidistant
public boolean isEquidistant()- Returns:
- the equidistant
-
isMoveTo
public boolean isMoveTo() -
isClosePath
public boolean isClosePath() -
withC
- Parameters:
mask- specifies which control point must be setc- the c to set- Returns:
- a new instance
-
withC
-
withPoint
- Parameters:
c0- the c0 to set- Returns:
- a new instance
-
withPoint
- Parameters:
x0- the x0 to sety0- the y0 to set- Returns:
- a new instance
-
withPointAndTranslatedInOut
- Parameters:
c0- the c0 to set- Returns:
- a new instance
-
withPointAndTranslatedInOut
- Parameters:
c0- the c0 to set- Returns:
- a new instance
-
withIn
- Parameters:
c1- the c0 to set- Returns:
- a new instance
-
withIn
- Parameters:
inX- the x1 to setinY- the y1to set- Returns:
- a new instance
-
withOut
- Parameters:
c2- the c0 to set- Returns:
- a new instance
-
withOut
- Parameters:
outX- the x2 to setoutY- the y2 to set- Returns:
- a new instance
-
withCollinear
- Parameters:
collinear- the collinear to set- Returns:
- a new instance
-
withEquidistant
- Parameters:
equidistant- the equidistant to set- Returns:
- a new instance
-
withMask
- Parameters:
mask- the mask to set- Returns:
- a new instance
-
withMaskBitsSet
Sets all the bits in the specified mask.- Parameters:
mask- the mask to set- Returns:
- a new instance
-
withMaskBitsClears
Clears all the bits in the specified mask.- Parameters:
mask- the mask to set- Returns:
- a new instance
-
toString
-
transform
-
transform
-