net.paulhertz.aifile
Class BezVertex

java.lang.Object
  extended by net.paulhertz.aifile.BezVertex
All Implemented Interfaces:
Vertex2DINF

public class BezVertex
extends Object
implements Vertex2DINF

Provides storage for a cubic Bezier curves's control points and terminal anchor point.


Field Summary
static int segmentType
          path segemnt type
 
Constructor Summary
BezVertex()
          initializes all points to 0,0
BezVertex(float cx1, float cy1, float cx2, float cy2, float x, float y)
           
 
Method Summary
 BezVertex clone()
           
 float[] coords()
           
 float cx1()
           
 float cx2()
           
 float cy1()
           
 float cy2()
           
 void draw(PApplet parent)
          Draws a path to the display.
 void draw(PGraphics pg)
          Draws a path to an offscreen buffer.
 int segmentType()
           
 void setCx1(float newCx1)
           
 void setCx2(float newCx2)
           
 void setCy1(float newCy1)
           
 void setCy2(float newCy2)
           
 void setX(float newX)
           
 void setY(float newY)
           
 void write(PrintWriter output)
          Writes a path segment to file.
 float x()
           
 float y()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

segmentType

public static final int segmentType
path segemnt type

See Also:
Constant Field Values
Constructor Detail

BezVertex

public BezVertex(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

BezVertex

public BezVertex()
initializes all points to 0,0

Method Detail

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 Vertex2DINF
Returns:
x-coordinate as a float

setX

public void setX(float newX)

y

public float y()
Specified by:
y in interface Vertex2DINF
Returns:
y-coordinate as a float

setY

public void setY(float newY)

segmentType

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

coords

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

clone

public BezVertex clone()
Specified by:
clone in interface Vertex2DINF
Overrides:
clone in class Object
Returns:
a deep copy of a Vertex2DINF

draw

public void draw(PApplet parent)
Description copied from interface: Vertex2DINF
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 Vertex2DINF
Parameters:
parent - the PApplet that handles drawing

draw

public void draw(PGraphics pg)
Description copied from interface: Vertex2DINF
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 Vertex2DINF
Parameters:
pg - a PGraphics instance

write

public void write(PrintWriter output)
Description copied from interface: Vertex2DINF
Writes a path segment to file. Multiple calls to this method should be bracketed by AIFileWriter.psMoveTo and AIFileWriter.paintPath commands

Specified by:
write in interface Vertex2DINF
Parameters:
output - a PrintWriter for output to file


Processing library IgnoCodeLib by Paul Hertz. (C) 2013