We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › continuously smooth objects
Page Index Toggle Pages: 1
continuously smooth objects (Read 721 times)
continuously smooth objects
Apr 22nd, 2007, 9:26am
 
I want to draw compound curves that are continuously smooth (no sharp angles).  What's the best way to do this?

I want to draw something like this (drawn in Illustrator): http://www.michaelang.com/images/bezier.png

Maybe I can use bezierTangent and set the first control point of the next anchor point to lie along the tangent?

Thanks,
 - mang
Re: continuously smooth objects
Reply #1 - Apr 27th, 2007, 11:26am
 
For two bezier joined curves to be continuous the control points on each side of the joining point must be colinear. An example:

Code:
void setup() {
size(400,400);
}

void draw() {
float xD,yD;

xD=width/2-mouseX;
yD=height/2-mouseY;

background(200);
noFill();

bezier(0,0,
300,100,
width/2-xD,height/2-yD,
width/2,height/2);

bezier(width/2,height/2,
width/2+xD,height/2+yD,
400,300,
400,400);
}
Re: continuously smooth objects
Reply #2 - Apr 27th, 2007, 9:09pm
 
Awesome, thanks!  (The middle point in that Illustrator screenshot should have given me the hint...)
Page Index Toggle Pages: 1