Dinamically setting the points of a bezierVertex in a PShape
in
Core Library Questions
•
4 months ago
Hi all,
I'm drawing PShapes that basically are born quite small (this is when I create it) and then I increase their size dinamically, using setVertex(). I'm using Processing 2.0.
All of this is ok, until I want to change a shape that has been made using some bezier vertexs myShape. bezierVertex(...), and not only the typical vertex() method. For instance, drawing a heart:
doing this, when I call getVertexCount(), I get 42 vertexs!! Why? I just defined a few of them. Does processing calculates the path and creates like 20 'normal' vertexs for each of my bezierVertex?
Is there an easy way to access to the bezierVertexs I defined, in order I can update their values? As I see in the PShape javadoc page, there's nothing like setBezierVertex, that's what I'd ideally need, so I could update the 6 parameters I used when defining the bezierVertex.
Also, calling getVertexCode() throws a null pointer error, plus processing doesn't show it in blue color like, for instance, getVertex, so it makes me think getVertexCode is not fully/correctly implemented?:
at processing.core.PShape.getVertexCode(PShape.java:2401)
...
Any help or light on this issue will be very highly appreciated. Thanks!
I'm drawing PShapes that basically are born quite small (this is when I create it) and then I increase their size dinamically, using setVertex(). I'm using Processing 2.0.
All of this is ok, until I want to change a shape that has been made using some bezier vertexs myShape. bezierVertex(...), and not only the typical vertex() method. For instance, drawing a heart:
- myShape = createShape();
- myShape.beginShape();
- myShape.vertex (heartSize/2, heartSize*0.15);
- myShape.bezierVertex(heartSize*0.5, -heartSize*0.05, heartSize*0.9, heartSize*0.05, heartSize*0.5, heartSize*0.4);
- myShape.vertex(heartSize/2, heartSize*0.15);
- myShape.bezierVertex(heartSize*0.5, -heartSize*0.05, heartSize*0.1, heartSize*0.05, heartSize*0.5, heartSize*0.4);
- myShape.endShape();
doing this, when I call getVertexCount(), I get 42 vertexs!! Why? I just defined a few of them. Does processing calculates the path and creates like 20 'normal' vertexs for each of my bezierVertex?
Is there an easy way to access to the bezierVertexs I defined, in order I can update their values? As I see in the PShape javadoc page, there's nothing like setBezierVertex, that's what I'd ideally need, so I could update the 6 parameters I used when defining the bezierVertex.
Also, calling getVertexCode() throws a null pointer error, plus processing doesn't show it in blue color like, for instance, getVertex, so it makes me think getVertexCode is not fully/correctly implemented?:
- for (int i=0; i<myShape.getVertexCount(); i++) {
- //println(myShape.getVertex(i)+" "+myShape.getVertexCode(i)); //Can't use it! it crashes!!
- println(myShape.getVertex(i)+" ");
- }
at processing.core.PShape.getVertexCode(PShape.java:2401)
...
Any help or light on this issue will be very highly appreciated. Thanks!
1