Processing in Netbeans

neues Java Projekt

core.jar als Library hinzufügen

import

extends

package mikolaskova_processing;
import processing.core.*;
/**
 *
 * @author addi
 */
public class MySketch  extends PApplet{
     public void setup(){
        size(300,300);
     }
    public void draw(){
    rect(mouseX, mouseY, 20,20);
    }
    
}
  

Formen generieren

Bezierkurve : bezierVertex oder PShape?

Bezierkurve: 

beginShape();
vertex(30, 10);
bezierVertex(80, 0, 80, 75, 30, 75);
bezierVertex(50, 80, 60, 25, 30, 20);
endShape();

PShape:

PShape s;  // The PShape object

void setup() {
  size(100, 100, P2D);
  // Creating a custom PShape as a square, by
  // specifying a series of vertices.
  s = createShape();
  s.beginShape();
  s.fill(0, 0, 255);
  s.noStroke();
  s.vertex(0, 0);
  s.vertex(0, 50);
  s.vertex(50, 50);
  s.vertex(50, 0);
  s.endShape(CLOSE);
}

void draw() {
  shape(s, 25, 25);
}
http://processing.org/reference/PShape.html
bezierVertex(80, 0, 80, 75, 30, 75);