Class Spiral2DPathIterator

  • All Implemented Interfaces:
    PathIterator


    public class Spiral2DPathIterator
    extends ParametricPathIterator
    The iterates over a spiral shape.

    This path can be modeled by:
      centerX+coilGap*(t+coilOffset)*Math.cos(2*Math.PI*t*m+angularOffset);

      centerY+coilGap*(t+coilOffset)*Math.sin(2*Math.PI*t*m+angularOffset);

    See Also:
    Spiral2D
    • Constructor Detail

      • Spiral2DPathIterator

        public Spiral2DPathIterator(double centerX,
                                    double centerY,
                                    double coilGap,
                                    double coils,
                                    double angularOffset,
                                    double coilOffset,
                                    boolean clockwise,
                                    boolean outward)
        Create a new Spiral2DPathIterator.
        Parameters:
        centerX - the x-coordinate of the center.
        centerY - the y-coordinate of the center.
        coilGap - the space between coils.
        coils - the number of coils in this spiral.
        angularOffset - the angle at the center of this spiral.
        coilOffset - the space from the center of the spiral to where the path begins painting.
        clockwise - whether this spiral spins out from the center
        outward - whether this spiral spins out from the center, or inwards towards it. clockwise (true) or counter-clockwise (false). This argument only matters if you're going to closely study the path this iterator returns. If you simply render it: this argument is meaningless.
      • Spiral2DPathIterator

        public Spiral2DPathIterator(double centerX,
                                    double centerY,
                                    double coilGap,
                                    double coils,
                                    double angularOffset,
                                    double coilOffset,
                                    boolean clockwise)
        Create a new Spiral2DPathIterator.
        Parameters:
        centerX - the x-coordinate of the center.
        centerY - the y-coordinate of the center.
        coilGap - the space between coils.
        coils - the number of coils in this spiral.
        angularOffset - the angle at the center of this spiral.
        coilOffset - the space from the center of the spiral to where the path begins painting.
        clockwise - whether this spiral spins out from the center clockwise (true) or counter-clockwise (false).
      • Spiral2DPathIterator

        public Spiral2DPathIterator(double centerX,
                                    double centerY,
                                    double coilGap,
                                    double coils,
                                    double angularOffset,
                                    double coilOffset,
                                    boolean clockwise,
                                    boolean outward,
                                    AffineTransform transform)
        Create a new Spiral2DPathIterator.
        Parameters:
        centerX - the x-coordinate of the center.
        centerY - the y-coordinate of the center.
        coilGap - the space between coils.
        coils - the number of coils in this spiral.
        angularOffset - the angle at the center of this spiral.
        coilOffset - the space from the center of the spiral to where the path begins painting.
        clockwise - whether this spiral spins out from the center clockwise (true) or counter-clockwise (false).
        outward - whether this spiral spins out from the center, or inwards towards it. This argument only matters if you're going to closely study the path this iterator returns. If you simply render it: this argument is meaningless.
        transform - an optional AffineTransform to apply to this path.
    • Method Detail

      • createSpiral

        public static GeneralPath createSpiral(double centerX,
                                               double centerY,
                                               double coilGap,
                                               double coils,
                                               double angularOffset,
                                               double coilOffset,
                                               boolean clockwise,
                                               boolean outward)
        Create a spiral stored in a GeneralPath.
        Parameters:
        centerX - the x-coordinate of the center.
        centerY - the y-coordinate of the center.
        coilGap - the space between coils.
        coils - the number of coils in this spiral.
        angularOffset - the angle at the center of this spiral.
        coilOffset - the space from the center of the spiral to where the path begins painting.
        clockwise - whether this spiral spins out from the center
        outward - whether this spiral spins out from the center, or inwards towards it. clockwise (true) or counter-clockwise (false). This argument only matters if you're going to closely study the path this iterator returns. If you simply render it: this argument is meaningless.
      • getDX

        protected double getDX(double t)
      • getDY

        protected double getDY(double t)
      • getX

        protected double getX(double t)
      • getY

        protected double getY(double t)
      • getMaxT

        protected double getMaxT()
        Description copied from class: ParametricPathIterator
        The highest value for t.
        Specified by:
        getMaxT in class  ParametricPathIterator
        Returns:
        the max value for t. Once this value is used this PathIterator is finished.
      • getNextT

        protected double getNextT(double t)
        Description copied from class: ParametricPathIterator
        The t-value that we should use next. If this is greater than getMaxT(), then the maximum is used in the next segment and this PathIterator is finished.
        Specified by:
        getNextT in class  ParametricPathIterator
        Parameters:
        t - the current t-value
        Returns:
        the next t-value