FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Bugs
   Bug Fixes, Implemented Suggestions
(Moderator: fry)
   bezierVertex shapes not always filled
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: bezierVertex shapes not always filled  (Read 1977 times)
spaceboygibbs


bezierVertex shapes not always filled
« on: Feb 26th, 2004, 7:12pm »

this might just be down to rounding errors, but something strange is going on.
here's a function to draw 2s by 2s squares with rounded corners, the top-left corner of the surrounding square is at (Ox, Oy):
 
void draw_shape(float Ox, float Oy, float s, color fill_color) {
fill(fill_color);
stroke(0);
beginShape(POLYGON);
bezierVertex(Ox,Oy+s);
bezierVertex(Ox,Oy);
bezierVertex(Ox,Oy);
bezierVertex(Ox+s,Oy);
bezierVertex(Ox+s,Oy);
bezierVertex(Ox+2*s,Oy);
bezierVertex(Ox+2*s,Oy);
bezierVertex(Ox+2*s,Oy+s);
bezierVertex(Ox+2*s,Oy+s);
bezierVertex(Ox+2*s,Oy+2*s);
bezierVertex(Ox+2*s,Oy+2*s);
bezierVertex(Ox+s,Oy+2*s);
bezierVertex(Ox+s,Oy+2*s);
bezierVertex(Ox, Oy+2*s);
bezierVertex(Ox, Oy+2*s);
bezierVertex(Ox, Oy+s);
endShape();
 
i call this repeatedly from a pair of nested for loops to draw a repeating pattern, some of the shapes get filled with the correct fill_color, most don't get filled at all. The only shape type to allow any of the shapes to be filled is POLYGON the other types result in none of the shapes being filled in.
 
fry


WWW
Re: bezierVertex shapes not always filled
« Reply #1 on: Feb 26th, 2004, 9:24pm »

hm, what's the rest of the code look like that's calling the draw_shape so i can see what it looks like?
 
one thing that will cause trouble is if the final point meets the beginning vertex on a concave polygon, which will confuse processing into thinking that the polygon isn't concave.
 
mattgilbert

tangramkid WWW Email
Re: bezierVertex shapes not always filled
« Reply #2 on: Jul 13th, 2004, 12:03am »

I'm having similar problems, although I don't really know exactly how bezierVertex works, so it may just be that my code is wrong. but here's a full example of how the bezier stuff doesn't always fill correctly:
 
(click the applet for focus, then move the mouse around to see when it fills and when it doesn't)
 
www.mattgilbert.net/bezierPlay
 
Am I not putting the right bezierVertex calls? Is there a better way to draw bezier shapes? (I've heard of bezier(a, b, c, d, t), but I don't know what the parameters "a" and so on are.)
 
Thanks for any help. Terrible work-arounds (such as http://www.mattgilbert.net/bezierPlayHack/ ) are welcome.
 
Matt
 
« Last Edit: Jul 13th, 2004, 12:14am by mattgilbert »  
fry


WWW
Re: bezierVertex shapes not always filled
« Reply #3 on: Jul 13th, 2004, 5:21am »

turns out there's a bug where some of the points (vertices) are getting duplicated, which confuses the tesselator.
 
fixed for megabucket, at any rate.
thanks for the reports & examples..
« Last Edit: Jul 13th, 2004, 5:21am by fry »  
Pages: 1 

« Previous topic | Next topic »