We are about to switch to a new forum software. Until then we have removed the registration on this forum.
The following makes me wonder why the family kind is geometry instead of path. Should I consider it a bug and fill in a bug report?
void setup() {
size(400, 400, P2D);
PShape sBezierVertexPath = createShape();
sBezierVertexPath.setName("sBezierVertexPath");
sBezierVertexPath.beginShape();
sBezierVertexPath.noFill();
sBezierVertexPath.vertex(30, 20);
sBezierVertexPath.bezierVertex(80, 0, 380, 375, 330, 375);
sBezierVertexPath.endShape();
if (sBezierVertexPath.getFamily() == PShape.GEOMETRY) {
println("why is it GEOMETRY instead of a PATH");
}
}
Answers
Note sure. Some links:
Ad 1. Without a parameter, the default family type of a createShape() call in the P2D renderer is GEOMETRY. If you want to set it to something else, you can supply a parameter. Such as: createShape(PShape.PATH);
Ad 2. Inconclusive. bezierVertex indeed mentioned with PATH. But perhaps when you use beginShape(), it's always GEOMETRY? Maybe PATH is reserved for SVG?
Ad 3. Documentation provides some info, but is perhaps not completely up to date with the latest, incremental development of the code.
Try this:
Now PShape.PATH is set. It won't draw anything! So that has to be a bug. I think I go debug some processing tomorrow. createShape(ARC, ... is also screwed up. If you end it with the options for PIE, CHORD or OPEN then they are used for that, but they are used for ellipseMode at the same time...
And it's missing some things. The vertices are stored in PShape as a float[][]. You can get about anything except the vertices as an array. To get the vertices for example you have to make something like this:
public float[][] getVertices(PShape s) {
There has been a lot of development on these, so doing some debugging is probably a good idea. With regard to the PShape.PATH, and it not displaying, I am still unsure. If it displays as is, with the family type GEOMETRY, then perhaps this is the intended way for beginShape-endShape PShapes and all their types of vertices (see ad 2 above). If it works, why do you need it to be of family type PATH? $0.02
I work on a library to have a lot of additional methods for the PShape. Some of the bugs I come across forces me to either make work arounds, ignore them, or fix them. And for the future of processing I think it's best to fix them.
I'm investigating at the moment what is causing it.
hmm,
createShape
should not be used withPShape.PATH
orPShape.GEOMETRY
. In other words, the user can not create a shape of type path, only geometry. (Unless avoiding the createShape method).I think processing has never ever drawn a shape of type Path yet :)