Class PABezVertex

java.lang.Object
net.paulhertz.pixelaudio.curves.PABezVertex
All Implemented Interfaces:
PAVertex2DINF

public class PABezVertex extends Object implements PAVertex2DINF
Provides storage for a cubic Bezier curves's control points and anchor point. Adapted from IgnoCodeLib Processing library for use with PixelAudio library. IgnoCodeLib is available in the Processing contributed libraries and at https://paulhertz.net/ignocodelib/ and https://github.com/Ignotus-mago/IgnoCodeLib3
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected float
    x-coordinate of first control point
    protected float
    x-coordinate of second control point
    protected float
    y-coordinate of first control point
    protected float
    y-coordinate of second control point
    static final int
    path segemnt type
    protected float
    x-coordinate of terminal anchor point
    protected float
    y-coordinate of terminal anchor point
  • Constructor Summary

    Constructors
    Constructor
    Description
    initializes all points to 0,0
    PABezVertex(float cx1, float cy1, float cx2, float cy2, float x, float y)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    float[]
     
    float
    cx1()
     
    float
    cx2()
     
    float
    cy1()
     
    float
    cy2()
     
    void
    draw(processing.core.PApplet parent)
    Draws a path to the display.
    void
    draw(processing.core.PGraphics pg)
    Draws a path to an offscreen buffer.
    void
    mark(processing.core.PApplet parent)
    Draws marks at vertices and control points.
    void
    mark(processing.core.PGraphics pg)
    Draws marks at vertices and control points to an off-screen PGraphics.
    int
     
    void
    setCx1(float newCx1)
     
    void
    setCx2(float newCx2)
     
    void
    setCy1(float newCy1)
     
    void
    setCy2(float newCy2)
     
    void
    setX(float newX)
     
    void
    setY(float newY)
     
    float
    x()
     
    float
    y()
     

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • cx1

      protected float cx1
      x-coordinate of first control point
    • cy1

      protected float cy1
      y-coordinate of first control point
    • cx2

      protected float cx2
      x-coordinate of second control point
    • cy2

      protected float cy2
      y-coordinate of second control point
    • x

      protected float x
      x-coordinate of terminal anchor point
    • y

      protected float y
      y-coordinate of terminal anchor point
    • segmentType

      public static final int segmentType
      path segemnt type
      See Also:
  • Constructor Details

    • PABezVertex

      public PABezVertex(float cx1, float cy1, float cx2, float cy2, float x, float y)
      Parameters:
      cx1 - x-coordinate of first control point
      cy1 - y-coordinate of first control point
      cx2 - x-coordinate of second control point
      cy2 - y-coordinate of second control point
      x - x-coordinate of terminal anchor point
      y - y-coordinate of terminal anchor point
    • PABezVertex

      public PABezVertex()
      initializes all points to 0,0
  • Method Details

    • cx1

      public float cx1()
    • setCx1

      public void setCx1(float newCx1)
    • cy1

      public float cy1()
    • setCy1

      public void setCy1(float newCy1)
    • cx2

      public float cx2()
    • setCx2

      public void setCx2(float newCx2)
    • cy2

      public float cy2()
    • setCy2

      public void setCy2(float newCy2)
    • x

      public float x()
      Specified by:
      x in interface PAVertex2DINF
      Returns:
      x-coordinate as a float
    • setX

      public void setX(float newX)
    • y

      public float y()
      Specified by:
      y in interface PAVertex2DINF
      Returns:
      y-coordinate as a float
    • setY

      public void setY(float newY)
    • segmentType

      public int segmentType()
      Specified by:
      segmentType in interface PAVertex2DINF
      Returns:
      type of segment, either BezShape.LINE_SEGMENT or BezShape.CURVE_SEGMENT
    • coords

      public float[] coords()
      Specified by:
      coords in interface PAVertex2DINF
      Returns:
      coordinates as an array of float
    • clone

      public PABezVertex clone()
      Specified by:
      clone in interface PAVertex2DINF
      Overrides:
      clone in class Object
      Returns:
      a deep copy of a Vertex2DINF
    • draw

      public void draw(processing.core.PApplet parent)
      Description copied from interface: PAVertex2DINF
      Draws a path to the display. It is only valid to call this within a Processing beginShape/endShape pair where an initial vertex has been set with a call to vertex().
      Specified by:
      draw in interface PAVertex2DINF
      Parameters:
      parent - the PApplet that handles drawing
    • draw

      public void draw(processing.core.PGraphics pg)
      Description copied from interface: PAVertex2DINF
      Draws a path to an offscreen buffer. It is only valid to call this within a Processing beginShape/endShape pair where an initial vertex has been set with a call to vertex().
      Specified by:
      draw in interface PAVertex2DINF
      Parameters:
      pg - a PGraphics instance
    • mark

      public void mark(processing.core.PApplet parent)
      Description copied from interface: PAVertex2DINF
      Draws marks at vertices and control points.
      Specified by:
      mark in interface PAVertex2DINF
    • mark

      public void mark(processing.core.PGraphics pg)
      Description copied from interface: PAVertex2DINF
      Draws marks at vertices and control points to an off-screen PGraphics.
      Specified by:
      mark in interface PAVertex2DINF