Class SplinePathBuilder.CPoint

java.lang.Object
org.bzdev.geom.SplinePathBuilder.CPoint
Enclosing class:
SplinePathBuilder

public static class SplinePathBuilder.CPoint extends Object
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 Details

    • type

      Field implementing a factory parameter.
    • x

      public double x
      Field implementing a factory parameter.
    • y

      public double y
      Field implementing a factory parameter.
    • xfOps

      public NamedFunctionOps xfOps
      Field implementing a factory parameter.
    • yfOps

      public NamedFunctionOps yfOps
      Field implementing a factory parameter.
    • t1

      public double t1
      Field implementing a factory parameter.
    • t2

      public double t2
      Field implementing a factory parameter.
    • n

      public int n
      Field implementing a factory parameter.
  • 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 point
      x - 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(NamedFunctionOps xfOps, NamedFunctionOps yfOps, double t1, double t2, int n) throws IllegalArgumentException
      Constructor for the SPLINE_FUNCTION case using instances of NamedFunctionOps. This constructor is provided for use by various subclasses of NamedObjectFactory as the last argument of a factory's set or add method in most cases cannot be an an instance of RealValuedFunction.
      Parameters:
      xfOps - the object providing the function for the x coordinates
      yfOps - the object providing the function for the y coordinates
      t1 - the initial value for the range of values at which the function will be evaluated
      t2 - the final value for the range of values at which the function will be evaluated
      n - the number of segments
      Throws:
      IllegalArgumentException - a function was null or n was not positive
    • CPoint

      public CPoint(RealValuedFunctOps xf, RealValuedFunctOps yf, double t1, double t2, int n) throws IllegalArgumentException
      Constructor for the SPINE_FUNCTION case.
      Parameters:
      xf - the function for the x coordinates
      yf - the function for the y coordinates
      t1 - an end for the range of values at which the function will be evaluated
      t2 - an end for the range of values at which the function will be evaluated
      n - 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 point
      point - 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

      public CPoint(SplinePathBuilder.CPointType type)
      Constructor given a type. The x and y coordinates will be zero. This form is useful primarily then the CPointType is CLOSE. Otherwise one should also set the public fields for this object appropriate for the given type.
      Parameters:
      type - the control point type.
    • CPoint

      public CPoint(SplinePathBuilder.CPointType type, double x, double y, AffineTransform af)
      Constructor given X and Y coordinates, and an affine transformation.
      Parameters:
      type - the type of the control point
      x - the position along the x access.
      y - the position along the y access.
      af - an affine transform to apply to cpoint
    • CPoint

      public CPoint(NamedFunctionOps xfOps, NamedFunctionOps yfOps, double t1, double t2, int n, AffineTransform af)
      Constructor for the SPLINE_FUNCTION case using instances of NamedFunctionOps with an affine transformation applied to the values of the functions. This constructor is provided for use by various subclasses of NamedObjectFactory as the last argument of a factory's set or add method in most cases cannot be an an instance of RealValuedFunction.
      Parameters:
      xfOps - the object providing the function for the x coordinates
      yfOps - the object providing the function for the y coordinates
      t1 - the initial value for the range of values at which the function will be evaluated
      t2 - the final value for the range of values at which the function will be evaluated
      n - the number of segments
      af - the affine transformation
      Throws:
      IllegalArgumentException - a function was null or n was not positive
    • CPoint

      public CPoint(RealValuedFunctOps xf, RealValuedFunctOps yf, double t1, double t2, int n, AffineTransform af) throws IllegalArgumentException
      Constructor for the SPINE_FUNCTION case with an affine transformation applies to values computed by the functions.
      Parameters:
      xf - the function for the x coordinates
      yf - the function for the y coordinates
      t1 - an end for the range of values at which the function will be evaluated
      t2 - an end for the range of values at which the function will be evaluated
      n - the number of segments
      af - the affine transformation
      Throws:
      IllegalArgumentException - a function was null or n was not positive