Class PACurveMaker

java.lang.Object
net.paulhertz.pixelaudio.curves.PACurveMaker
All Implemented Interfaces:
PAGesture

public class PACurveMaker extends Object implements PAGesture

PACurveMaker is a utility and storage class for gestures and curve modeling, with point reduction and drawing to on-screen PApplets or off-screen PGraphics. It implements PAGesture and provides a pair of data structures, dragPoints and dragTimes, that together capture gestures made with a mouse or similar input device. It is a core component of the PixelAudio library.

Each point in dragPoints is associated with a corresponding time in dragTimes. You can use PACurveMaker for data storage in interactive drawing applications, or implement your own storage with just the features you require. It is a key data structure for playing digital audio instruments using granular synthesis and sampling in the net.paulhertz.pixelaudio.granular and net.paulhertz.pixelaudio.sampler packages.

PACUrveMaker makes extensive use of static methods in PACurveUtility and provides a wide range of graphic objects and properties for dense point arrays, reduced point arrays, derived Bezier curves (weighted and not weighted), brushstroke Bezier shapes for drawing to the display, and brushstroke polygons for point testing with PABezShape.pointInPoly(). It provides some basic timing data associated with drawing to the screen. You can use PACurveUtility for drawing all PACurveMaker data formats or you can use the built-in commands if you use PACurveMaker as a storage class.

PACurveMaker's factory methods take as their principal argument a list of PVectors, dragPoints, a list of time offsets in milliseconds, dragTimes, and an absolute time in milliseconds, startTimeMs. The list of points is typically derived from a line drawn by dragging the mouse across the application window. This line is stored in dragPoints and can be accessed with getDragPoints() or getAllPoints(). dragPoints can be mutated with mutateAllPoints(), preserving its cardinality.

The dense point set in dragPoints can be processed by the Ramer-Douglas-Peucker algorithm to derive a a reduced point set, rdpPoints. The algorithm is implemented in PACUrveUtilities. The reduced points can be turned into a Bezier path, curveShape, where each point in rdpPoints becomes an anchor point in curveShape. Bezier paths are modeled using PixelAudio's PABezShape class, which includes methods for drawing attributes, affine transforms, and point testing. For display and interaction, a brushstroke shape, brushShape, can be created from the curve. An array of PVectors, eventPoints, can be created from curveShape to facilitate timed event-staging along the curve. Another array of PVectors, brushPoly, can be used to test points with #PABezShape.pointInPoly().

Each of the geometric data objects--dragPoints, rdpPoints, curveShape, and brushShape--has a method for drawing to the screen in a PApplet or drawing offscreen in a PGraphic. DragPoints and rdpPoints keep their drawing parameters (fill, stroke, weight) in PACurveMaker variables. PABezShapes like curveShape and brushShape can store drawing parameters internally.

There are several properties of PACurveMaker that can affect the appearance of curves. The value of epsilon determines how closely the reduced point set in rdpPoints matches the dense point set in dragPoints. Smaller values, down to 1.0, yield a reduced point set with more points and greater precision. Some of the factory methods allow you to supply your own value for epsilon, which defaults to 8.0. Weighted curves and brushstrokes are variations on the smooth Bezier curves that PACurveMaker generates by default. In the default curves, the rate of change in curvature is the same on either side of a Bezier anchor point. The weighted curves use a value, bezierBias, to adjust the control points. The default bias value, PABezShape.LAMBDA, may provide a closer approximation to rdpPoints. Other values can create extreme curves. It's worth some experimentation. If you call setDrawWeighted(boolean) with a value of true and then call calculateDerivedPoints(), curveShape and brushShape will be generated as weighted Bezier curves. There are several calls to generate weighted Bezier curves. They do not set local variables, but can be useful for exploring the variations created by different values of bezierBias. PACurveUtility can also create weighted curves.

NOTES 2025.12.14

eventPoints is a List<PVector> derived from the gestural points captured during user interaction. dragPoints is reduced to rdpPoints. rdpPoints is used to derive the Bezier path (PABezShape) curveShape. The polyline representation of curveShape is eventPoints, where display events tied to the curve can be located.
To reduce confusion, I have created some alias methods in PACurveMaker:

          // Alias method for getDragPoints().
          public ArrayList<PVector> getAllPoints() {
                return this.getDragPoints();
          }
  
          // Alias for getRdpPoints(). 
          public ArrayList<PVector> getReducedPoints() {
                return getRdpPoints();
          }
  
          // Sets epsilon and returns the reduced point set, this.rdpPoints
          public ArrayList<PVector> getReducedPoints(float epsilon) {
                if (this.epsilon != epsilon || rdpPoints.size() < 1) {
                        this.setEpsilon(epsilon);
                        calculateDerivedPoints();
                }
                return rdpPoints;
          }
  
          // Alias for getCurveShape().
          public PABezShape getCurve() {
                return this.getCurveShape();
          }
          
          // Alias for getEventPoints().
    public ArrayList<PVector> getCurvePoints() {
                return this.getEventPoints();
          }
  
          // Alias for getEventPoints(int eventSteps).
          public ArrayList<PVector> getCurvePoints(int curveSteps) {
                return this.getEventPoints(curveSteps);
          }
 
          // Alias for eventSteps 
    public int getCurveSteps() {
      return this.eventSteps;
    }
    

In addition, I note that the primary point sets in PACUrveMaker are dragPoints (getAllPoints()), rdpPoints (getCurvePoints()), and eventPoints (getCurvePoints()). The full gesture is conveyed by dragPoints and dragTimes. The indices of rdpPoints are tracked and stored in ArrayList<Integer> rdpIndices, so that we can map back to the original gesture points if needed. The points in rdpPoints are also the anchor points in the Bezier path curveShape, produced from curveShape = PACurveUtility.calculateCurve(rdpPoints);.

We can also get the reduced time list:
    public int[] getReducedTimes() {
                int[] timeIndices = getRdpIndicesAsInts();
                int[] rdpTimes = new int[timeIndices.length];
                // the first value in dragTimes is a time stamp, all following numbers are offsets
                // one for each point in dragPoints. We only need the offsets. 
                int[] allTimes = this.getDragOffsetsAsInts();
                for (int i = 0; i < timeIndices.length; i++) {
                        rdpTimes[i] = allTimes[timeIndices[i]];
                }
                return rdpTimes;
          }
    
Changing epsilon will change the reduced point set, and thus the Bezier curve and event points. rdpIndices must be recalculated whenever epsilon is changed. This is done in PACurveMaker.calculateDerivedPoints(), which is called from setEpsilon() and public ArrayList<PVector> getReducedPoints(float epsilon) The new reduced point time set can be derived from rdpIndices when needed. NOTES 2025.12.23

As much as possible, PACurveMaker now relies on lazy initialization, though end user can initialize all geometry up from with calculateDerivedPoints(). I have also introduced the interface PAGesture, to clarify how PACurveMaker structures originate in capture gestures from a GUI or other source. A gesture is constructed from

  1. a list of points and
  2. a list of time offsets where
  3. both lists have the same cardinality and
  4. time offsets increase monotonically. In addition,
  5. the time list is expected (but not required) to start with a first element 0.
Absolute time of gesture creation can be stored in startTime, as millis from application start.

GestureSchedule provides some static methods to help enforce the invariants of gestures.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Simple Processing-friendly callback interface.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    Color for highlighted brush stroke, stored in brushShape
    private float
    A weight applied to calculations of the control points for Bezier curves
    int
    Color for simulated brushstroke fill and stroke, stored in brushShape
    boolean
    using a custom brush shape
    private ArrayList<processing.core.PVector>
    polygon representation of brushShape, for point testing, etc.
    private PABezShape
    A simulated brush stroke derived from curveShape, a closed shape rather than a curved line
    float
    The distance in pixels between the edges of the brush stroke, double the distance from the central line
    float
    weight of stroke for brushStroke, set to 0 for no stroke
    int
    Color for Bezier curve derived from drawPoints, stored in bezPoints or weightedBezPoints
    private PABezShape
    A path composed of Bezier curves and lines, a continuous curved line derived from rdpPoints
    float
    weight of curved line curveShape
    private boolean
    reduced points changed OR brush params changed
    private boolean
    brushShape changed OR polySteps changed
    private boolean
    reduced points changed
    private boolean
    curve points changed OR curveSteps changed
    private boolean
    epsilon changed OR allPoints changed
    int
    boolean value that determines whether curve and brush shapes are weighted
    private ArrayList<processing.core.PVector>
    List of non-repeating points that need to be reduced, typically from a UI gesture such as dragging a mouse, optical flow of a video image, flocks of boids, etc.
    private int[]
    List of time data: first element is expected to be 0 and the remaining elements are non-decreasing offsets in millis from the first element.
    (package private) float[]
    Cache for float[] version of dragTimes
    float
    weight of lines drawn between PVectors in allPoints
    private float
    A parameter to control the amount of reduction in the RDP algorithm
    private ArrayList<processing.core.PVector>
    List of points where events such as audio samples can be triggered, derived from the polygon representation of curveShape, accessed with getEventPoints() or getCurvePoints()
    int
    color of eventPoints markers
    float
    size of eventPoints markers
    int
    number of steps along a polygonized curve, used to produce eventPoints from curveShape
    boolean
    boolean to determine if bezierBias, "weight", is applied to curve calculations
    int
    number of steps along a polygonized brushstroke shape, used to produce brushPoly
    int
    Color for points reduced by RDP algorithm, stored in drawPoints
    list of indices of points in dragPoints captured for rdpPoints
    private ArrayList<processing.core.PVector>
    The reduced points returned by the RDP algorithm
    float
    weight of lines drawn between PVectors in drawPoints
    int
    Time of mouseReleased event, in milliseconds elapsed since timeStamp
    int
    Time when CurveMaker instance was initialized by mousePressed event, in milliseconds since application startup
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    PACurveMaker(List<processing.core.PVector> dragPoints, List<Integer> dragTimes, int startTimeMs)
    Constructor for PACurveMaker, called by all factory methods.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Applies a transform state to this curve.
    void
    brushDraw(processing.core.PApplet parent)
    Draws the stored brushShape to a PApplet using local properties this.brushColor, this.brushColor, this.brushWeight.
    void
    brushDraw(processing.core.PApplet parent, int brushColor, int strokeColor, float brushWeight)
    Draws the stored brushShape to a PApplet using supplied fill color, stroke color, and weight.
    void
    brushDraw(processing.core.PGraphics pg)
    Draws the stored brushShape to an offscreen PGraphics using local properties this.brushColor, this.brushColor, this.brushWeight.
    void
    brushDraw(processing.core.PGraphics pg, int brushColor, int strokeColor, float brushWeight)
    Draws the stored brushShape to an offscreen PGraphics using supplied fill color, stroke color, and weight.
    void
    brushDrawDirect(processing.core.PApplet parent)
    Draws the stored brush shape to a PApplet using its properties as a PABezShape.
    void
    brushDrawDirect(processing.core.PGraphics pg)
    Draws the stored brush shape to an offscreen PGraphics using its properties as a PABezShape.
    buildBrushShape(ArrayList<processing.core.PVector> knotPoints)
     
    buildCurveMaker(ArrayList<processing.core.PVector> dragPoints)
    This factory method can be used when you are only using the curve modeling features of PACurveMaker.
    buildCurveMaker(ArrayList<processing.core.PVector> dragPoints, float epsilon)
    This factory method can be used when you are only using the curve modeling features of PACurveMaker.
    buildCurveMaker(ArrayList<processing.core.PVector> points, float epsilon, float brushSize, int brushColor)
    This factory method can be used when you are only using the curve modeling features of PACurveMaker.
    buildCurveMaker(List<processing.core.PVector> dragPoints, List<Integer> dragTimes, int startTimeMs)
     
    buildCurveMaker(List<processing.core.PVector> dragPoints, List<Integer> dragTimes, int startTimeMs, float epsilon)
     
    buildCurveMaker(List<processing.core.PVector> dragPoints, List<Integer> dragTimes, int startTimeMs, float epsilon, float brushSize, int brushColor)
     
    buildCurveMaker(List<processing.core.PVector> dragPoints, List<Integer> dragTimes, int startTimeMs, float epsilon, int dragColor, float dragWeight, int rdpColor, float rdpWeight, int curveColor, float curveWeight, int brushColor, float brushWeight, int activeBrushColor)
    Creates a PACurveMaker instance set up for lazy initialization.
    void
    Calculates rdpPoints, curveShape, eventPoints, brushShape and brushPoly.
    void
    Sets brushIsCustom to false, prepares rebuild of brush from curveShape
    ArrayList<processing.core.PVector>
    Returns a copy of points in dragPoints, the original dense point set captured from a gesture.
    Copies the current dragPoints into a new GestureTransformState as restPoints.
    void
    curveDraw(processing.core.PApplet parent)
    Draws a Bezier curve using the 2D Bezier curve data in this.curveShape and the current values of this.curveColor and this.curveWeight.
    void
    curveDraw(processing.core.PGraphics pg)
    Draws a Bezier curve using the 2D Bezier curve data in this.curveShape and the current values of this.curveColor and this.curveWeight.
    void
    curveDrawDirect(processing.core.PApplet parent)
    Draws a Bezier curve using local drawing properties of curveShape.
    void
    curveDrawDirect(processing.core.PGraphics pg)
    Draws a Bezier curve using local drawing properties of this.curveShape as a PABezShape.
    Returns a string with information about the curve, including values of epsilon, curveSteps, polySteps, timeOffset, and counts of drag points, drag times, reduced points, and curve points.
    void
    dragPointsDraw(processing.core.PApplet parent)
    Draws a line using the PVector data in allPoints and the current values of this.dragColor and this.dragWeight.
    void
    dragPointsDraw(processing.core.PApplet parent, int lineColor, float lineWeight)
    Draws a line using the PVector data in dragPoints and a supplied color.
    void
    dragPointsDraw(processing.core.PGraphics pg)
    Draws dragPoints to a PGraphics using local color and weight, this.dragColor and this.dragWeight.
    void
    dragPointsDraw(processing.core.PGraphics pg, int lineColor, float lineWeight)
    Draws dragPoints to a PGraphics using supplied color and weight.
    private void
    Ensures that the brush shape is calculated and up-to-date.
    private void
    Ensures that the brush polygon is calculated and up-to-date.
    private void
    Ensures that the curve is calculated and up-to-date.
    private void
    Ensures that the event points are calculated and up-to-date.
    private void
    Ensures that the reduced point set is up to date.
    void
    eventPointsDraw(processing.core.PApplet parent)
    Draws this.eventPoints to a PApplet as circles using local properties this.eventPointsColor and this.eventPointsSize.
    void
    eventPointsDraw(processing.core.PApplet parent, int eventPointsColor, float eventPointsSize)
    Draws this.eventPoints to a PApplet as circles using supplied properties eventPointsColor and eventPointsSize.
    void
    eventPointsDraw(processing.core.PApplet parent, int eventSteps, int eventPointsColor, float eventPointsSize)
    Draws this.eventPoints to a PApplet as circles using supplied properties eventPointsSteps, eventPointsColor and eventPointsSize.
    void
    eventPointsDraw(processing.core.PGraphics pg)
    Draws this.eventPoints to an offscreen PGraphics as circles using local properties this.eventPointsColor and this.eventPointsSize.
    void
    eventPointsDraw(processing.core.PGraphics pg, int eventPointsColor, float eventPointsSize)
    Draws this.eventPoints to an offscreen PGraphics as circles using supplied properties eventPointsColor and eventPointsSize.
    void
    eventPointsDraw(processing.core.PGraphics pg, int eventSteps, int eventPointsColor, float eventPointsSize)
    Draws this.eventPoints to an offscreen PGraphics as circles using supplied properties eventPointsSteps, eventPointsColor and eventPointsSize.
    int
     
    ArrayList<processing.core.PVector>
    Alias method for getDragPoints().
    Returns the schedule for all points in the gesture.
    int[]
    getAllTimes() is a convenient alias for getDragTimes()
    float
    Returns the bias value for adjusting distances between Bezier anchor points and control points.
    int
     
    ArrayList<processing.core.PVector>
    Returns a list of points that comprise a closed polygonal shape that closely folllows the brushstroke.
    Returns a PABezShape that looks like a brushstroke, created by expanding curveShape, an open Bezier path, into a closed Bezier path.
    float
    Returns the size of the brush in pixels.
    float
     
    Alias for getCurveShape().
    int
     
    ArrayList<processing.core.PVector>
    Alias for getEventPoints().
    ArrayList<processing.core.PVector>
    getCurvePoints(int curveSteps)
    Alias for getEventPoints(int curveSteps).
    getCurveSchedule(float epsilon, int curveSteps, boolean arcLengthTime)
    Returns the schedule for the points along a polyline approximation of the Bezier curve derived from the reduced point set.
    Returns a PABezShape for the curved line derived from the reduced point set.
    int
    Alias for getEventSteps()
    float
     
    int
     
    ArrayList<processing.core.PVector>
    Returns a copy of points in dragPoints, the original dense point set captured from a gesture.
    int[]
     
    float
     
    float
     
    ArrayList<processing.core.PVector>
    Returns the points along along a polyline approximation of the Bezier path curveShape, derived from the reduced point set.
    ArrayList<processing.core.PVector>
    getEventPoints(int eventSteps)
     
    int
     
    float
     
    int
    Returns the number of segments in each curve for a polygonal approximation of Bezier path curveShape.
    int
    Returns the number of divisions of each Bezier curve in the polygonal representation of brushShape.
    int
     
    Returns the indices of the reduced points in the original dragPoints list.
    int[]
    Returns the indices of the reduced points in the original dragPoints list as an array of integers.
    ArrayList<processing.core.PVector>
    Returns the reduced point set for this PACurveMaker.
    float
     
    ArrayList<processing.core.PVector>
    Alias for getReducedPoints(this.epsilon).
    ArrayList<processing.core.PVector>
    getReducedPoints(float epsilon)
    Sets epsilon and returns the reduced point set, this.rdpPoints
    getReducedSchedule(float epsilon)
    Returns the schedule for the reduced points in the gesture.
    int[]
    Returns the reduced time data for the gesture.
    long
    Alias for getTimeStamp()
    int
    Returns the time offset for the gesture, typically the time in milliseconds between the timeStamp and the end of the gesture: the duration of the gesture in milliseconds.
    float[]
    Returns time offsets as floats.
    int
    Returns the timestamp for the gesture.
     
    getWeightedBrushShape(float brushSize, float bias)
     
    Returns a PABezShape for the weighted curve derived from the reduced point set.
    Calculates a PABezSHape with distances between control points and anchor points adjusted by bezierBias.
    boolean
    Returns whether weighted Bezier curves are drawn.
    boolean
    Checks whether the cached geometry is up to date.
    void
    Call after mutating dragPoints contents or order (or changing dragTimes length).
    void
    Call after changing brush size/weighting/bias.
    void
    Call after changing only curveSteps/eventSteps.
    void
    Call after changing only epsilon-sensitive state (typically point geometry changed).
    void
    Mutate the live dragPoints list (and/or its PVectors) and automatically mark cached geometry as dirty afterward.
    private static int[]
     
    void
    reducedPointsDraw(processing.core.PApplet parent)
    Draws a line using the PVector data in rdpPoints and the current values of this.rdpColor and this.rdpWeight.
    void
    reducedPointsDraw(processing.core.PApplet parent, int lineColor, float lineWeight)
    Draws a line using the PVector data in drawPoints, the reduced point set derived from allPoints.
    void
    reducedPointsDraw(processing.core.PGraphics pg)
    Draws drawPoints to a PGraphics using current values of this.rdpColor and this.rdpWeight.
    void
    reducedPointsDraw(processing.core.PGraphics pg, int lineColor, float lineWeight)
    Draws rdpPoints to a PGraphics using supplied color and weight.
    private void
    reducePoints(float epsilon)
    Takes the list of points in allPoints and generates a reduced list in drawPoints.
    void
    Restores this curve from a transform state's rest pose, if present.
    void
    setActiveBrushColor(int activeBrushColor)
     
    void
    setBezierBias(float bias)
    Sets the bias value for adjusting distances between Bezier anchor points and control points.
    void
    setBrushColor(int brushColor)
     
    void
    setBrushSize(float newSize)
    Set the distance in pixels between opposite edges of a brushstroke.
    void
    setBrushWeight(float brushWeight)
     
    void
    setCurveColor(int curveColor)
     
    void
    setCurveSteps(int curveSteps)
    Alias for setEventSteps(int).
    void
    setCurveWeight(float curveWeight)
     
    void
    setCustomBrushShape(PABezShape customBrushShape)
    Replaces the closed PABezShape "brushstroke" with a shape of your own choosing.
    void
    setDragColor(int dragColor)
     
    void
    setDragPoints(ArrayList<processing.core.PVector> dragPoints)
    Deprecated.
    void
    setDragTimes(int[] dragTimes)
    Sets the list of time data for the gesture captured by dragPoints.
    void
    Sets the list of time data for the gesture captured by dragPoints.
    void
    setDragWeight(float dragWeight)
     
    void
    setDrawingProperties(int dragColor, float dragWeight, int rdpColor, float rdpWeight, int curveColor, float curveWeight, int brushColor, float brushWeight, int activeBrushColor)
    Sets various properties used for drawing PACurveMaker graphics.
    void
    setDrawWeighted(boolean drawBiased)
    Flag whether to draw weighted Bezier curves, displacing control points from the anchor by a specified bias, bezierBias.
    void
    setEpsilon(float eps)
    Sets value of variable epsilon, used in reduced point set calculations.
    void
    setEventPointsColor(int eventPointsColor)
     
    void
    setEventPointsSize(float eventPointsSize)
     
    void
    setEventSteps(int steps)
    If eventPoints is null or if eventSteps differs from the old value, sets a new value for eventSteps and calculates eventPoints.
    void
    setPolySteps(int steps)
    Sets the number of divisions of each Bezier curve in the polygonal representation of brushShape.
    void
    setRdpColor(int rdpColor)
     
    void
    Deprecated.
    void
    setRdpPoints(ArrayList<processing.core.PVector> rdpPoints)
    Deprecated.
    void
    setRdpWeight(float rdpWeight)
     
    void
    setTimeOffset(int timeOffset)
    Sets the time offset for the gesture, typically the time in milliseconds between the timeStamp and the end of the gesture: the duration of the gesture in milliseconds.
    void
    setTimeStamp(int timeStamp)
    Sets the timestamp for the gesture.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.paulhertz.pixelaudio.curves.PAGesture

    isEmpty, size
  • Field Details

    • dragPoints

      private ArrayList<processing.core.PVector> dragPoints
      List of non-repeating points that need to be reduced, typically from a UI gesture such as dragging a mouse, optical flow of a video image, flocks of boids, etc.
    • rdpPoints

      private ArrayList<processing.core.PVector> rdpPoints
      The reduced points returned by the RDP algorithm
    • rdpIndices

      private ArrayList<Integer> rdpIndices
      list of indices of points in dragPoints captured for rdpPoints
    • epsilon

      private float epsilon
      A parameter to control the amount of reduction in the RDP algorithm
    • curveShape

      private PABezShape curveShape
      A path composed of Bezier curves and lines, a continuous curved line derived from rdpPoints
    • eventPoints

      private ArrayList<processing.core.PVector> eventPoints
      List of points where events such as audio samples can be triggered, derived from the polygon representation of curveShape, accessed with getEventPoints() or getCurvePoints()
    • eventSteps

      public int eventSteps
      number of steps along a polygonized curve, used to produce eventPoints from curveShape
    • brushShape

      private PABezShape brushShape
      A simulated brush stroke derived from curveShape, a closed shape rather than a curved line
    • brushPoly

      private ArrayList<processing.core.PVector> brushPoly
      polygon representation of brushShape, for point testing, etc.
    • polySteps

      public int polySteps
      number of steps along a polygonized brushstroke shape, used to produce brushPoly
    • timeStamp

      public int timeStamp
      Time when CurveMaker instance was initialized by mousePressed event, in milliseconds since application startup
    • timeOffset

      public int timeOffset
      Time of mouseReleased event, in milliseconds elapsed since timeStamp
    • dragTimes

      private int[] dragTimes
      List of time data: first element is expected to be 0 and the remaining elements are non-decreasing offsets in millis from the first element.
    • dragTimesFloat

      float[] dragTimesFloat
      Cache for float[] version of dragTimes
    • isDrawWeighted

      public boolean isDrawWeighted
      boolean to determine if bezierBias, "weight", is applied to curve calculations
    • bezierBias

      private float bezierBias
      A weight applied to calculations of the control points for Bezier curves
    • brushSize

      public float brushSize
      The distance in pixels between the edges of the brush stroke, double the distance from the central line
    • dragColor

      public int dragColor
      boolean value that determines whether curve and brush shapes are weighted
    • dragWeight

      public float dragWeight
      weight of lines drawn between PVectors in allPoints
    • rdpColor

      public int rdpColor
      Color for points reduced by RDP algorithm, stored in drawPoints
    • rdpWeight

      public float rdpWeight
      weight of lines drawn between PVectors in drawPoints
    • curveColor

      public int curveColor
      Color for Bezier curve derived from drawPoints, stored in bezPoints or weightedBezPoints
    • curveWeight

      public float curveWeight
      weight of curved line curveShape
    • brushColor

      public int brushColor
      Color for simulated brushstroke fill and stroke, stored in brushShape
    • activeBrushColor

      public int activeBrushColor
      Color for highlighted brush stroke, stored in brushShape
    • brushWeight

      public float brushWeight
      weight of stroke for brushStroke, set to 0 for no stroke
    • eventPointsColor

      public int eventPointsColor
      color of eventPoints markers
    • eventPointsSize

      public float eventPointsSize
      size of eventPoints markers
    • brushIsCustom

      public boolean brushIsCustom
      using a custom brush shape
    • dirtyReduced

      private boolean dirtyReduced
      epsilon changed OR allPoints changed
    • dirtyCurve

      private boolean dirtyCurve
      reduced points changed
    • dirtyEvent

      private boolean dirtyEvent
      curve points changed OR curveSteps changed
    • dirtyBrush

      private boolean dirtyBrush
      reduced points changed OR brush params changed
    • dirtyBrushPoly

      private boolean dirtyBrushPoly
      brushShape changed OR polySteps changed
  • Constructor Details

    • PACurveMaker

      private PACurveMaker(List<processing.core.PVector> dragPoints, List<Integer> dragTimes, int startTimeMs)
      Constructor for PACurveMaker, called by all factory methods.
      Parameters:
      dragPoints - a list of points (PVector) where no two successive points are identical
      dragTimes - a list of times in milliseconds, successively offset from first entry of 0
      startTimeMs - an absolute time in milliseconds, determined by the application, for the gesture to begin
  • Method Details

    • buildCurveMaker

      public static PACurveMaker buildCurveMaker(List<processing.core.PVector> dragPoints, List<Integer> dragTimes, int startTimeMs)
      Parameters:
      dragPoints - a list of points (PVector) where no two successive points are identical
      dragTimes - a list of times in milliseconds, successively offset from first entry of 0
      startTimeMs - an absolute time in milliseconds, determined by the application, for the gesture to begin
      Returns:
      a PACurveMaker instance, set up for lazy initialization
    • buildCurveMaker

      public static PACurveMaker buildCurveMaker(List<processing.core.PVector> dragPoints, List<Integer> dragTimes, int startTimeMs, float epsilon)
      Parameters:
      dragPoints - a list of points (PVector) where no two successive points are identical
      dragTimes - a list of times in milliseconds, successively offset from first entry of 0
      startTimeMs - an absolute time in milliseconds, determined by the application, for the gesture to begin
      epsilon - the expected distance between reduced points, lower values typically produce more points
      Returns:
      a PACurveMaker instance, set up for lazy initialization
    • buildCurveMaker

      public static PACurveMaker buildCurveMaker(List<processing.core.PVector> dragPoints, List<Integer> dragTimes, int startTimeMs, float epsilon, float brushSize, int brushColor)
      Parameters:
      dragPoints - a list of points (PVector) where no two successive points are identical
      dragTimes - a list of times in milliseconds, successively offset from first entry of 0
      startTimeMs - an absolute time in milliseconds, determined by the application, for the gesture to begin
      epsilon - the expected distance between reduced points, lower values typically produce more points
      brushSize - the width in pixels of a simulated brushstroke created from the Bezier path derived from rdpPoints
      brushColor - the color assigned to the brushstroke
      Returns:
      a PACurveMaker instance, set up for lazy initialization
    • buildCurveMaker

      public static PACurveMaker buildCurveMaker(ArrayList<processing.core.PVector> dragPoints)
      This factory method can be used when you are only using the curve modeling features of PACurveMaker. Entries in the time offsets list dragTimes will be set to 0 and startTimesMs will be set to 0. If you set values for dragTimes and startTimeMs later, dragTimes and dragPoints must be the same size.
      Parameters:
      dragPoints - a list of points (PVector) where no two successive points are identical
      Returns:
      a PACUrveMaker instance
    • buildCurveMaker

      public static PACurveMaker buildCurveMaker(ArrayList<processing.core.PVector> dragPoints, float epsilon)
      This factory method can be used when you are only using the curve modeling features of PACurveMaker. Entries in the time offsets list dragTimes will be set to 0 and startTimesMs will be set to 0. If you set values for dragTimes and startTimeMs later, dragTimes and dragPoints must be the same size.
      Parameters:
      dragPoints - a list of points (PVector), where no two successive points are identical
      epsilon - controls amount of thinning of points to derive the reduced point set rdpPoints from dragPoints
      Returns:
      a PACurveMaker instance
    • buildCurveMaker

      public static PACurveMaker buildCurveMaker(ArrayList<processing.core.PVector> points, float epsilon, float brushSize, int brushColor)
      This factory method can be used when you are only using the curve modeling features of PACurveMaker. Entries in the time offsets list dragTimes will be set to 0 and startTimesMs will be set to 0. If you set values for dragTimes and startTimeMs later, dragTimes and dragPoints must be the same size.
      Parameters:
      points - a list of points (PVector), where no two successive points are identical
      epsilon - controls amount of thinning of points to derive the reduced point set rdpPoints from dragPoints
      brushSize - the width in pixels of a simulated brushstroke created from the Bezier path derived from rdpPoints
      brushColor - the color assigned to the brushstroke
      Returns:
      a PACurveMaker instance
    • buildCurveMaker

      public static PACurveMaker buildCurveMaker(List<processing.core.PVector> dragPoints, List<Integer> dragTimes, int startTimeMs, float epsilon, int dragColor, float dragWeight, int rdpColor, float rdpWeight, int curveColor, float curveWeight, int brushColor, float brushWeight, int activeBrushColor)
      Creates a PACurveMaker instance set up for lazy initialization. Sets various properties used for drawing PACurveMaker graphics.
      Parameters:
      dragPoints -
      dragTimes -
      startTimeMs -
      epsilon -
      dragColor -
      dragWeight -
      rdpColor -
      rdpWeight -
      curveColor -
      curveWeight -
      brushColor -
      brushWeight -
      activeBrushColor -
      Returns:
    • setDrawingProperties

      public void setDrawingProperties(int dragColor, float dragWeight, int rdpColor, float rdpWeight, int curveColor, float curveWeight, int brushColor, float brushWeight, int activeBrushColor)
      Sets various properties used for drawing PACurveMaker graphics.
      Parameters:
      dragColor -
      dragWeight -
      rdpColor -
      rdpWeight -
      curveColor -
      curveWeight -
      brushColor -
      brushWeight -
      activeBrushColor -
    • normalizeOffsets

      private static int[] normalizeOffsets(int[] t)
    • reducePoints

      private void reducePoints(float epsilon)
      Takes the list of points in allPoints and generates a reduced list in drawPoints.
      Parameters:
      epsilon - controls amount of thinning applied to dragPoints to derive rdpPoints
    • calculateDerivedPoints

      public void calculateDerivedPoints()
      Calculates rdpPoints, curveShape, eventPoints, brushShape and brushPoly. Sets isReady to true on completion. Call calculateDerivedPoints to refresh the drawing objects rdpPoints, curveShape, eventPoints, brushShape, and brushPoly. We can build all the relevant data structures for geometry here, typically on initialization. After that, we can rely on lazy rebuilding, using the "dirty flags".
    • isReady

      public boolean isReady()
      Checks whether the cached geometry is up to date. If any of the dirty flags are true, returns false.
      Returns:
      true if all cached geometry is up to date, false if any dirty flags are true
    • getDragPoints

      public ArrayList<processing.core.PVector> getDragPoints()
      Returns a copy of points in dragPoints, the original dense point set captured from a gesture.
      Returns:
      ArrayList of PVector, a dense set of points for drawing a line
    • copyAllPoints

      public ArrayList<processing.core.PVector> copyAllPoints()
      Returns a copy of points in dragPoints, the original dense point set captured from a gesture.
      Returns:
      ArrayList of PVector, a dense set of points for drawing a line
    • getAllPoints

      public ArrayList<processing.core.PVector> getAllPoints()
      Alias method for getDragPoints().
      Specified by:
      getAllPoints in interface PAGesture
      Returns:
      ArrayList of PVector
    • setDragPoints

      @Deprecated public void setDragPoints(ArrayList<processing.core.PVector> dragPoints)
      Deprecated.
      TODO remove: use mutateAllPoints() to change points. Changes the value of dragPoints and immediately calls calculateDerivedPoints() to refresh all drawing objects.
      Parameters:
      dragPoints - ArrayList of PVector, a dense set of points for drawing a line
    • mutateAllPoints

      public void mutateAllPoints(PACurveMaker.PointsMutator mutator)
      Mutate the live dragPoints list (and/or its PVectors) and automatically mark cached geometry as dirty afterward. Typical use: translating/scaling/warping points for animation. IMPORTANT: - If you change the number/order of points, you must also update dragTimes so that (dragTimes.size() == dragPoints.size()).
    • createTransformState

      public GestureTransformState createTransformState()
      Copies the current dragPoints into a new GestureTransformState as restPoints.
    • applyTransform

      public void applyTransform(GestureTransformState state)
      Applies a transform state to this curve.
    • restoreTransform

      public void restoreTransform(GestureTransformState state)
      Restores this curve from a transform state's rest pose, if present.
    • markDirtyAll

      public void markDirtyAll()
      Call after mutating dragPoints contents or order (or changing dragTimes length).
    • markDirtyReduced

      public void markDirtyReduced()
      Call after changing only epsilon-sensitive state (typically point geometry changed).
    • markDirtyEventPoints

      public void markDirtyEventPoints()
      Call after changing only curveSteps/eventSteps.
    • markDirtyBrush

      public void markDirtyBrush()
      Call after changing brush size/weighting/bias.
    • getEpsilon

      public float getEpsilon()
      Returns:
      the value of epsilon, used to control precision of reduced point set calculations
    • setEpsilon

      public void setEpsilon(float eps)
      Sets value of variable epsilon, used in reduced point set calculations. If the new value is not equal to the old value, will trigger various "dirty flags" to force rebuild of cached values.
      Parameters:
      eps - value for epsilon
    • getRdpPoints

      public ArrayList<processing.core.PVector> getRdpPoints()
      Returns the reduced point set for this PACurveMaker.
      Returns:
      ArrayList of PVector, the reduced point set
    • getReducedPoints

      public ArrayList<processing.core.PVector> getReducedPoints()
      Alias for getReducedPoints(this.epsilon).
      Returns:
      a list of PVectors, the reduced point set for this PACurveMaker.
    • getReducedPoints

      public ArrayList<processing.core.PVector> getReducedPoints(float epsilon)
      Sets epsilon and returns the reduced point set, this.rdpPoints
      Parameters:
      epsilon - parameter for RDP algorithm, determines distance/angle for culling points
      Returns:
      a list of PVectors, the reduced point set for this PACurveMaker
    • ensureReduced

      private void ensureReduced()
      Ensures that the reduced point set is up to date.
    • setRdpPoints

      @Deprecated public void setRdpPoints(ArrayList<processing.core.PVector> rdpPoints)
      Deprecated.
      Sets rdpPoints, generally not something you want to do: let reducePoints() or calculateDerivedPoints() derive rdpPoints from dragPoints instead.
      Parameters:
      rdpPoints -
    • getRdpIndices

      public ArrayList<Integer> getRdpIndices()
      Returns the indices of the reduced points in the original dragPoints list. Can be used to derive the reduced time list from dragTimes when needed.
      Returns:
      ArrayList of Integer, the indices of the reduced points
    • getRdpIndicesAsInts

      public int[] getRdpIndicesAsInts()
      Returns the indices of the reduced points in the original dragPoints list as an array of integers.
      Returns:
      int[], the indices of the reduced points
    • setRdpIndices

      @Deprecated public void setRdpIndices(ArrayList<Integer> rdpIndices)
      Deprecated.
      Sets rdpIndices, generally not something you want to do. Call reducePoints() or calculateDerivedPoints instead and stay out of trouble.
      Parameters:
      rdpIndices -
    • getEventSteps

      public int getEventSteps()
      Returns the number of segments in each curve for a polygonal approximation of Bezier path curveShape.
      Returns:
      the number of segments for a polygonal approximation of the curve
    • getCurveSteps

      public int getCurveSteps()
      Alias for getEventSteps()
      Returns:
      the number of segments for a polygonal approximation of the curve
    • setCurveSteps

      public void setCurveSteps(int curveSteps)
      Alias for setEventSteps(int).
      Parameters:
      curveSteps -
    • setEventSteps

      public void setEventSteps(int steps)
      If eventPoints is null or if eventSteps differs from the old value, sets a new value for eventSteps and calculates eventPoints.
      Parameters:
      steps - a new value for eventSteps
    • getEventPoints

      public ArrayList<processing.core.PVector> getEventPoints()
      Returns the points along along a polyline approximation of the Bezier path curveShape, derived from the reduced point set. The number of points is determined by eventSteps.
      Returns:
      this.eventPoints, the points along a polyline version of the Bezier curve derived from the reduced point set.
    • getEventPoints

      public ArrayList<processing.core.PVector> getEventPoints(int eventSteps)
      Parameters:
      eventSteps - the number of points along each polyline curve in the PABezShape this.curveShape
      Returns:
      this.eventPoints, the points along a polyline version of the Bezier curve derived from the reduced point set.
    • getCurvePoints

      public ArrayList<processing.core.PVector> getCurvePoints()
      Alias for getEventPoints().
      Returns:
      this.eventPoints, the points along a polyline version of the Bezier curve derived from the reduced point set.
    • getCurvePoints

      public ArrayList<processing.core.PVector> getCurvePoints(int curveSteps)
      Alias for getEventPoints(int curveSteps).
      Parameters:
      curveSteps -
      Returns:
      points along a polyline version of the Bezier curve derived from the reduced point set.
    • ensureEventPoints

      private void ensureEventPoints()
      Ensures that the event points are calculated and up-to-date.
    • getCurveShape

      public PABezShape getCurveShape()
      Returns a PABezShape for the curved line derived from the reduced point set.
      Returns:
      PABezShape for the curved line derived from the reduced point set.
    • getCurve

      public PABezShape getCurve()
      Alias for getCurveShape().
      Returns:
      PABezShape for the curved line derived from the reduced point set.
    • ensureCurve

      private void ensureCurve()
      Ensures that the curve is calculated and up-to-date.
    • getWeightedCurveShape

      public PABezShape getWeightedCurveShape(float bias)
      Calculates a PABezSHape with distances between control points and anchor points adjusted by bezierBias. Does not store the returned curve.
      Parameters:
      bias - a parameter to adjust distances between Bezier anchor points and control points.
      Returns:
      a Bezier curve shape whose control points are adjusted using bezierBias.
    • getWeightedCurveShape

      public PABezShape getWeightedCurveShape()
      Returns a PABezShape for the weighted curve derived from the reduced point set.
      Returns:
      a PABezShape for the weighted curve
    • isDrawWeighted

      public boolean isDrawWeighted()
      Returns whether weighted Bezier curves are drawn.
      Returns:
      true if weighted Bezier curves are drawn, false otherwise
    • setDrawWeighted

      public void setDrawWeighted(boolean drawBiased)
      Flag whether to draw weighted Bezier curves, displacing control points from the anchor by a specified bias, bezierBias. For example, we use the bias value PABezShape.KAPPA, to draw circles with four equidistant anchor points.
      Parameters:
      drawBiased -
    • getBezierBias

      public float getBezierBias()
      Returns the bias value for adjusting distances between Bezier anchor points and control points.
      Returns:
      the bias value
    • setBezierBias

      public void setBezierBias(float bias)
      Sets the bias value for adjusting distances between Bezier anchor points and control points.
      Parameters:
      bias - the bias value
    • getBrushSize

      public float getBrushSize()
      Returns the size of the brush in pixels.
      Returns:
      the brush size
    • setBrushSize

      public void setBrushSize(float newSize)
      Set the distance in pixels between opposite edges of a brushstroke.
      Parameters:
      newSize -
    • getBrushShape

      public PABezShape getBrushShape()
      Returns a PABezShape that looks like a brushstroke, created by expanding curveShape, an open Bezier path, into a closed Bezier path. Handy for interaction with gesture data. If you replaced the brush with your own PABezShape, you'll get your own shape back.
      Returns:
      a PABezShape that looks like a brushstroke, created by expanding curveShape, an open Bezier path, into a closed Bezier path. Handy for interaction with gesture data.
    • ensureBrush

      private void ensureBrush()
      Ensures that the brush shape is calculated and up-to-date.
    • getWeightedBrushShape

      public PABezShape getWeightedBrushShape()
      Returns:
      a PABezShape modifed by the bezierBias value, equal to PABezShape.LAMBDA by default. Experiment to see how values above and below LAMBDA affect the curves.
    • getWeightedBrushShape

      public PABezShape getWeightedBrushShape(float brushSize, float bias)
      Parameters:
      brushSize -
      bias -
      Returns:
      a PABezShape modifed by the bezierBias value, equal to PABezShape.LAMBDA by default. Experiment to see how values above and below LAMBDA affect the curves.
    • buildBrushShape

      public PABezShape buildBrushShape(ArrayList<processing.core.PVector> knotPoints)
      Parameters:
      knotPoints - a list of points that will be used to derive anchor points
      Returns:
      a closed Bezier path shaped like a stylized brushstroke around the supplied knotPoints
    • setCustomBrushShape

      public void setCustomBrushShape(PABezShape customBrushShape)
      Replaces the closed PABezShape "brushstroke" with a shape of your own choosing. Useful to provide a point of interaction. Rely on dragPoints or curveShape and dragTimes for gestures and timing.
      Parameters:
      customBrushShape -
    • clearCustomBrushShape

      public void clearCustomBrushShape()
      Sets brushIsCustom to false, prepares rebuild of brush from curveShape
    • getBrushPoly

      public ArrayList<processing.core.PVector> getBrushPoly()
      Returns a list of points that comprise a closed polygonal shape that closely folllows the brushstroke.
      Returns:
      a list of points that comprise a closed polygonal shape that closely folllows the brushstroke. Useful for point in polygon testing for interaction. If you replaced the brush with your own PABezShape, you'll get a polygonal representation of your own shape.
    • ensureBrushPoly

      private void ensureBrushPoly()
      Ensures that the brush polygon is calculated and up-to-date.
    • getPolySteps

      public int getPolySteps()
      Returns the number of divisions of each Bezier curve in the polygonal representation of brushShape.
      Returns:
      the number of divisions of each Bezier curve in the polygonal representation of brushShape.
    • setPolySteps

      public void setPolySteps(int steps)
      Sets the number of divisions of each Bezier curve in the polygonal representation of brushShape. If the new value is not equal to the old value, will trigger a rebuild of brushPoly.
      Parameters:
      steps - the number of divisions of each Bezier curve in the polygonal representation of brushShape. See also setEventSteps().
    • getTimeStamp

      public int getTimeStamp()
      Returns the timestamp for the gesture.
      Returns:
      the timestamp
    • setTimeStamp

      public void setTimeStamp(int timeStamp)
      Sets the timestamp for the gesture.
      Parameters:
      timeStamp - the timestamp
    • getStartTimeMs

      public long getStartTimeMs()
      Alias for getTimeStamp()
      Specified by:
      getStartTimeMs in interface PAGesture
      Returns:
      absolute gesture start time in milliseconds
    • getTimeOffset

      public int getTimeOffset()
      Returns the time offset for the gesture, typically the time in milliseconds between the timeStamp and the end of the gesture: the duration of the gesture in milliseconds.
      Returns:
    • setTimeOffset

      public void setTimeOffset(int timeOffset)
      Sets the time offset for the gesture, typically the time in milliseconds between the timeStamp and the end of the gesture: the duration of the gesture in milliseconds.
      Parameters:
      timeOffset -
    • getTimeOffsetsMs

      public float[] getTimeOffsetsMs()
      Returns time offsets as floats. First value should be 0, remaining ones are times from 0 in milliseconds.
      Specified by:
      getTimeOffsetsMs in interface PAGesture
      Returns:
      time offsets as floats. First value should be 0, remaining ones are times from 0 in milliseconds.
    • getDragTimes

      public int[] getDragTimes()
      Returns:
      the list of time data for the gesture captured by dragPoints: The first offset is expected to be 0 and the remaining elements are offsets in milliseconds.
    • getAllTimes

      public int[] getAllTimes()
      getAllTimes() is a convenient alias for getDragTimes()
      Returns:
      a list of time offsets, the first one equal to zero
    • setDragTimes

      public void setDragTimes(int[] dragTimes)
      Sets the list of time data for the gesture captured by dragPoints. The first offset is expected to be 0 and the remaining elements are offsets in milliseconds. The length of dragTimes must match the length of dragPoints.
      Parameters:
      dragTimes -
    • setDragTimes

      public void setDragTimes(List<Integer> dragTimes)
      Sets the list of time data for the gesture captured by dragPoints.
      Parameters:
      dragTimes -
    • getReducedTimes

      public int[] getReducedTimes()
      Returns the reduced time data for the gesture. The returned list is the same size as the reduced point set, and contains the time offsets corresponding to the reduced points. The first offset is expected to be 0 and the remaining elements are offsets in milliseconds.
      Returns:
      the reduced time data
    • getAllPointsSchedule

      public GestureSchedule getAllPointsSchedule()
      Returns the schedule for all points in the gesture.
      Specified by:
      getAllPointsSchedule in interface PAGesture
      Returns:
      the schedule for all points
    • getReducedSchedule

      public GestureSchedule getReducedSchedule(float epsilon)
      Returns the schedule for the reduced points in the gesture.
      Parameters:
      epsilon -
      Returns:
    • getCurveSchedule

      public GestureSchedule getCurveSchedule(float epsilon, int curveSteps, boolean arcLengthTime)
      Returns the schedule for the points along a polyline approximation of the Bezier curve derived from the reduced point set. The number of points is determined by curveSteps.
      Parameters:
      epsilon -
      curveSteps -
      arcLengthTime -
      Returns:
    • getDragColor

      public int getDragColor()
    • setDragColor

      public void setDragColor(int dragColor)
    • getDragWeight

      public float getDragWeight()
    • setDragWeight

      public void setDragWeight(float dragWeight)
    • getRdpColor

      public int getRdpColor()
    • setRdpColor

      public void setRdpColor(int rdpColor)
    • getRdpWeight

      public float getRdpWeight()
    • setRdpWeight

      public void setRdpWeight(float rdpWeight)
    • getCurveColor

      public int getCurveColor()
    • setCurveColor

      public void setCurveColor(int curveColor)
    • getCurveWeight

      public float getCurveWeight()
    • setCurveWeight

      public void setCurveWeight(float curveWeight)
    • getBrushColor

      public int getBrushColor()
    • setBrushColor

      public void setBrushColor(int brushColor)
    • getBrushWeight

      public float getBrushWeight()
    • setBrushWeight

      public void setBrushWeight(float brushWeight)
    • getActiveBrushColor

      public int getActiveBrushColor()
    • setActiveBrushColor

      public void setActiveBrushColor(int activeBrushColor)
    • getEventPointsColor

      public int getEventPointsColor()
    • setEventPointsColor

      public void setEventPointsColor(int eventPointsColor)
    • getEventPointsSize

      public float getEventPointsSize()
    • setEventPointsSize

      public void setEventPointsSize(float eventPointsSize)
    • curveInfo

      public String curveInfo()
      Returns a string with information about the curve, including values of epsilon, curveSteps, polySteps, timeOffset, and counts of drag points, drag times, reduced points, and curve points.
      Returns:
      a string with information about the curve
    • dragPointsDraw

      public void dragPointsDraw(processing.core.PApplet parent, int lineColor, float lineWeight)
      Draws a line using the PVector data in dragPoints and a supplied color.
      Parameters:
      parent - a PApplet where drawing takes place
      lineColor - color for the line that is drawn
    • dragPointsDraw

      public void dragPointsDraw(processing.core.PApplet parent)
      Draws a line using the PVector data in allPoints and the current values of this.dragColor and this.dragWeight.
      Parameters:
      parent - a PApplet where drawing takes place
    • reducedPointsDraw

      public void reducedPointsDraw(processing.core.PApplet parent, int lineColor, float lineWeight)
      Draws a line using the PVector data in drawPoints, the reduced point set derived from allPoints.
      Parameters:
      parent - a PApplet where drawing takes place
      lineColor - the color for the line that is drawn
      lineWeight - the weight of the line that is drawn
    • reducedPointsDraw

      public void reducedPointsDraw(processing.core.PApplet parent)
      Draws a line using the PVector data in rdpPoints and the current values of this.rdpColor and this.rdpWeight.
      Parameters:
      parent - a PApplet where drawing takes place
    • dragPointsDraw

      public void dragPointsDraw(processing.core.PGraphics pg, int lineColor, float lineWeight)
      Draws dragPoints to a PGraphics using supplied color and weight.
      Parameters:
      pg - a PGraphics offscreen graphics context
      lineColor - color for the line through the dense point set
      lineWeight - weight (in pixels) of the line through the dense point set
    • dragPointsDraw

      public void dragPointsDraw(processing.core.PGraphics pg)
      Draws dragPoints to a PGraphics using local color and weight, this.dragColor and this.dragWeight.
      Parameters:
      pg - a PGraphics offscreen graphics context
    • reducedPointsDraw

      public void reducedPointsDraw(processing.core.PGraphics pg, int lineColor, float lineWeight)
      Draws rdpPoints to a PGraphics using supplied color and weight.
      Parameters:
      pg - a PGraphics offscreen graphics context
      lineColor - color for the line through the reduced point set
      lineWeight - weight (in pixels) of the line through the reduced point set
    • reducedPointsDraw

      public void reducedPointsDraw(processing.core.PGraphics pg)
      Draws drawPoints to a PGraphics using current values of this.rdpColor and this.rdpWeight.
      Parameters:
      pg - a PGraphics offscreen graphics context
    • curveDraw

      public void curveDraw(processing.core.PApplet parent)
      Draws a Bezier curve using the 2D Bezier curve data in this.curveShape and the current values of this.curveColor and this.curveWeight. The resulting curve will have no fill.
      Parameters:
      parent - a PApplet instance
    • curveDrawDirect

      public void curveDrawDirect(processing.core.PApplet parent)
      Draws a Bezier curve using local drawing properties of curveShape. If the drawing properties use a fill, the resulting curve will have a fill.
      Parameters:
      parent - a PApplet instance
    • curveDraw

      public void curveDraw(processing.core.PGraphics pg)
      Draws a Bezier curve using the 2D Bezier curve data in this.curveShape and the current values of this.curveColor and this.curveWeight. The resulting curve will have no fill.
      Parameters:
      pg - a PGraphics offscreen graphics context
    • curveDrawDirect

      public void curveDrawDirect(processing.core.PGraphics pg)
      Draws a Bezier curve using local drawing properties of this.curveShape as a PABezShape. If the drawing properties use a fill, the resulting curve will have a fill.
      Parameters:
      pg - a PGraphics offscreen graphics context
    • brushDraw

      public void brushDraw(processing.core.PApplet parent, int brushColor, int strokeColor, float brushWeight)
      Draws the stored brushShape to a PApplet using supplied fill color, stroke color, and weight. If brushWeight == 0, there is no stroke.
      Parameters:
      parent -
      brushColor -
      strokeColor -
      brushWeight -
    • brushDraw

      public void brushDraw(processing.core.PApplet parent)
      Draws the stored brushShape to a PApplet using local properties this.brushColor, this.brushColor, this.brushWeight.
      Parameters:
      parent -
    • brushDrawDirect

      public void brushDrawDirect(processing.core.PApplet parent)
      Draws the stored brush shape to a PApplet using its properties as a PABezShape.
      Parameters:
      parent -
    • brushDraw

      public void brushDraw(processing.core.PGraphics pg, int brushColor, int strokeColor, float brushWeight)
      Draws the stored brushShape to an offscreen PGraphics using supplied fill color, stroke color, and weight. If brushWeight == 0, there is no stroke.
      Parameters:
      pg -
      brushColor -
      strokeColor -
      brushWeight -
    • brushDraw

      public void brushDraw(processing.core.PGraphics pg)
      Draws the stored brushShape to an offscreen PGraphics using local properties this.brushColor, this.brushColor, this.brushWeight.
      Parameters:
      pg -
    • brushDrawDirect

      public void brushDrawDirect(processing.core.PGraphics pg)
      Draws the stored brush shape to an offscreen PGraphics using its properties as a PABezShape.
      Parameters:
      pg - a PGraphics offscreen graphics context
    • eventPointsDraw

      public void eventPointsDraw(processing.core.PApplet parent)
      Draws this.eventPoints to a PApplet as circles using local properties this.eventPointsColor and this.eventPointsSize.
      Parameters:
      parent -
    • eventPointsDraw

      public void eventPointsDraw(processing.core.PApplet parent, int eventPointsColor, float eventPointsSize)
      Draws this.eventPoints to a PApplet as circles using supplied properties eventPointsColor and eventPointsSize.
      Parameters:
      parent -
      eventPointsColor -
      eventPointsSize -
    • eventPointsDraw

      public void eventPointsDraw(processing.core.PApplet parent, int eventSteps, int eventPointsColor, float eventPointsSize)
      Draws this.eventPoints to a PApplet as circles using supplied properties eventPointsSteps, eventPointsColor and eventPointsSize. EventPointsSteps determines the number of circles. The local value eventPointsSteps is not changed.
      Parameters:
      parent -
      eventSteps -
      eventPointsColor -
      eventPointsSize -
    • eventPointsDraw

      public void eventPointsDraw(processing.core.PGraphics pg)
      Draws this.eventPoints to an offscreen PGraphics as circles using local properties this.eventPointsColor and this.eventPointsSize.
      Parameters:
      pg -
    • eventPointsDraw

      public void eventPointsDraw(processing.core.PGraphics pg, int eventPointsColor, float eventPointsSize)
      Draws this.eventPoints to an offscreen PGraphics as circles using supplied properties eventPointsColor and eventPointsSize.
      Parameters:
      pg -
      eventPointsColor -
      eventPointsSize -
    • eventPointsDraw

      public void eventPointsDraw(processing.core.PGraphics pg, int eventSteps, int eventPointsColor, float eventPointsSize)
      Draws this.eventPoints to an offscreen PGraphics as circles using supplied properties eventPointsSteps, eventPointsColor and eventPointsSize. Parameter eventPointsSteps determines the number of circles. The local value eventPointsSteps is not changed.
      Parameters:
      pg -
      eventSteps -
      eventPointsColor -
      eventPointsSize -