java.lang.Object
org.bzdev.geom.SplinePathBuilder.CPoint
- Enclosing class:
- SplinePathBuilder
Control Point specification for SplinePathBuilder.
This class specifies a control point. An array of control
points defines a segment of a path added to the graph by
a call to
append
.
This class is annotated so that it can be used by named object factories. In this case, a parameter name is typically a component in a compound key. A list of these names are as follows:
- "type" - one of the following:
-
MOVE_TO
- Move to point. The entry must include an "x" and "y" parameter. -
MOVE_TO_NEXT
- Move to a point whose coordinates are given by the next entry, which must be a SPLINE or SPLINE_FUNCTION. If it is a SPLINE_FUNCTION, the value of the function at t1 will be used. -
CONTROL
- A control point for a cubic or quadratic curve. Both the x and y coordinates must be provided. at most 2 CONTROL points may appear in a row, and this subsequence must be terminated by a SEG_END. -
SPLINE
- A point along a spline. Both the x and y coordinates must be provided. -
SPLINE_FUNCTION
- Functions are used to compute a sequence of spline points. The parameter xf, yf, t1, t2, and n must be provided. -
SEG_END
- This represents the final point in a straight line, quadratic curve, cubic curve, or spline. Both the x and y coordinates must be provided. -
SEG_END_PREV
- This indicates that final point in a spline is the previous entry, which must have a type of SPLINE or SPLINE_FUNCTION. For the SPLINE_FUNCTION case, t2 will be used to compute the x and y coordinates of this point. -
CLOSE
- This indicates that the curve is closed. If the curve is a single spline, the spline will be a closed, smooth curve. Otherwise a line, if necessary, will be drawn from the current position to the last MOVE_TO coordinates.
-
- "x" - the x coordinate.
- "y" - the y coordinate.
- "xf" - the named object providing a function giving the x coordinate. This object will implement the NamedFunctionOps interface.
- "yf" - the named object providing a function giving the y coordinate. This object will implement the NamedFunctionOps interface.
- "t1" - The initial value of the argument passed to functions providing the x and y coordinates.
- "t2" - The final value of the argument passed to functions providing the x and y coordinates.
- "n" - The number of segments between points at which the functions are evaluated. This is one less than the number of those points.
-
Field Summary
FieldsModifier and TypeFieldDescriptionint
Field implementing a factory parameter providing the number of times a function will be evaluated to generate knots for a spline.double
Field implementing a factory parameter providing the minimum value of a function's argument.double
Field implementing a factory parameter providing the maximum value of a function's argument.Field implementing a factory parameter providing a type.double
Field implementing a factory parameter providing an X coordinate.Field implementing a factory parameter providing a function whose value is an X coordinate.double
Field implementing a factory parameter providing a Y coordinate.Field implementing a factory parameter providing a function whose value is a Y coordinate. -
Constructor Summary
ConstructorsConstructorDescriptionCPoint()
Constructor.Constructor given a type.CPoint
(SplinePathBuilder.CPointType type, double x, double y) Constructor given X and Y coordinates.CPoint
(SplinePathBuilder.CPointType type, double x, double y, AffineTransform af) Constructor given X and Y coordinates, and an affine transformation.CPoint
(SplinePathBuilder.CPointType type, Point2D point) Constructor given a point.CPoint
(RealValuedFunctOps xf, RealValuedFunctOps yf, double t1, double t2, int n) Constructor for theSPINE_FUNCTION
case.CPoint
(RealValuedFunctOps xf, RealValuedFunctOps yf, double t1, double t2, int n, AffineTransform af) Constructor for theSPINE_FUNCTION
case with an affine transformation applies to values computed by the functions. -
Method Summary
-
Field Details
-
type
Field implementing a factory parameter providing a type. -
x
public double xField implementing a factory parameter providing an X coordinate. -
y
public double yField implementing a factory parameter providing a Y coordinate. -
xfOps
Field implementing a factory parameter providing a function whose value is an X coordinate. -
yfOps
Field implementing a factory parameter providing a function whose value is a Y coordinate. -
t1
public double t1Field implementing a factory parameter providing the minimum value of a function's argument. -
t2
public double t2Field implementing a factory parameter providing the maximum value of a function's argument. -
n
public int nField implementing a factory parameter providing the number of times a function will be evaluated to generate knots for a spline.
-
-
Constructor Details
-
CPoint
public CPoint()Constructor. -
CPoint
public CPoint(SplinePathBuilder.CPointType type, double x, double y) throws IllegalArgumentException Constructor given X and Y coordinates.- Parameters:
type
- the type of the control pointx
- the position along the x access.y
- the position along the y access.- Throws:
IllegalArgumentException
- the type is not appropriate for a constructor providing x and y coordinates.
-
CPoint
public CPoint(RealValuedFunctOps xf, RealValuedFunctOps yf, double t1, double t2, int n) throws IllegalArgumentException Constructor for theSPINE_FUNCTION
case. The functions will be converted to instances of NamedFunctionOps, if necessary, for consistency with the use of this class bynamed object factories
.- Parameters:
xf
- the function for the x coordinatesyf
- the function for the y coordinatest1
- an end for the range of values at which the function will be evaluatedt2
- an end for the range of values at which the function will be evaluatedn
- the number of segments- Throws:
IllegalArgumentException
- a function was null or n was not positive
-
CPoint
Constructor given a point.- Parameters:
type
- the type of the control pointpoint
- the point at which the control point is located- Throws:
IllegalArgumentException
- the type is not appropriate for a constructor providing a point as an argument.
-
CPoint
Constructor given a type. The x and y coordinates will be zero. This form is useful primarily then the CPointType isCLOSE
. Otherwise one should also set the public fields for this object appropriate for the given type.- Parameters:
type
- the control point type.
-
CPoint
Constructor given X and Y coordinates, and an affine transformation.- Parameters:
type
- the type of the control pointx
- the position along the x access.y
- the position along the y access.af
- an affine transform to apply to cpoint
-
CPoint
public CPoint(RealValuedFunctOps xf, RealValuedFunctOps yf, double t1, double t2, int n, AffineTransform af) throws IllegalArgumentException Constructor for theSPINE_FUNCTION
case with an affine transformation applies to values computed by the functions. The functions will be converted to instances of NamedFunctionOps, if necessary, for consistency with the use of this class bynamed object factories
.- Parameters:
xf
- the function for the x coordinatesyf
- the function for the y coordinatest1
- an end for the range of values at which the function will be evaluatedt2
- an end for the range of values at which the function will be evaluatedn
- the number of segmentsaf
- the affine transformation- Throws:
IllegalArgumentException
- a function was null or n was not positive
-