Package net.paulhertz.pixelaudio.curves
Class PABezVertex
java.lang.Object
net.paulhertz.pixelaudio.curves.PABezVertex
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionprotected floatx-coordinate of first control pointprotected floatx-coordinate of second control pointprotected floaty-coordinate of first control pointprotected floaty-coordinate of second control pointstatic final intpath segemnt typeprotected floatx-coordinate of terminal anchor pointprotected floaty-coordinate of terminal anchor point -
Constructor Summary
ConstructorsConstructorDescriptioninitializes all points to 0,0PABezVertex(float cx1, float cy1, float cx2, float cy2, float x, float y) -
Method Summary
Modifier and TypeMethodDescriptionclone()float[]coords()floatcx1()floatcx2()floatcy1()floatcy2()voiddraw(processing.core.PApplet parent) Draws a path to the display.voiddraw(processing.core.PGraphics pg) Draws a path to an offscreen buffer.voidmark(processing.core.PApplet parent) Draws marks at vertices and control points.voidmark(processing.core.PGraphics pg) Draws marks at vertices and control points to an off-screen PGraphics.intvoidsetCx1(float newCx1) voidsetCx2(float newCx2) voidsetCy1(float newCy1) voidsetCy2(float newCy2) voidsetX(float newX) voidsetY(float newY) floatx()floaty()
-
Field Details
-
cx1
protected float cx1x-coordinate of first control point -
cy1
protected float cy1y-coordinate of first control point -
cx2
protected float cx2x-coordinate of second control point -
cy2
protected float cy2y-coordinate of second control point -
x
protected float xx-coordinate of terminal anchor point -
y
protected float yy-coordinate of terminal anchor point -
segmentType
public static final int segmentTypepath 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 pointcy1- y-coordinate of first control pointcx2- x-coordinate of second control pointcy2- y-coordinate of second control pointx- x-coordinate of terminal anchor pointy- 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:
xin interfacePAVertex2DINF- Returns:
- x-coordinate as a float
-
setX
public void setX(float newX) -
y
public float y()- Specified by:
yin interfacePAVertex2DINF- Returns:
- y-coordinate as a float
-
setY
public void setY(float newY) -
segmentType
public int segmentType()- Specified by:
segmentTypein interfacePAVertex2DINF- Returns:
- type of segment, either BezShape.LINE_SEGMENT or BezShape.CURVE_SEGMENT
-
coords
public float[] coords()- Specified by:
coordsin interfacePAVertex2DINF- Returns:
- coordinates as an array of float
-
clone
- Specified by:
clonein interfacePAVertex2DINF- Overrides:
clonein classObject- Returns:
- a deep copy of a Vertex2DINF
-
draw
public void draw(processing.core.PApplet parent) Description copied from interface:PAVertex2DINFDraws 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:
drawin interfacePAVertex2DINF- Parameters:
parent- the PApplet that handles drawing
-
draw
public void draw(processing.core.PGraphics pg) Description copied from interface:PAVertex2DINFDraws 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:
drawin interfacePAVertex2DINF- Parameters:
pg- a PGraphics instance
-
mark
public void mark(processing.core.PApplet parent) Description copied from interface:PAVertex2DINFDraws marks at vertices and control points.- Specified by:
markin interfacePAVertex2DINF
-
mark
public void mark(processing.core.PGraphics pg) Description copied from interface:PAVertex2DINFDraws marks at vertices and control points to an off-screen PGraphics.- Specified by:
markin interfacePAVertex2DINF
-