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_
   Programming Questions & Help
   Programs
(Moderators: fry, REAS)
   cubic interpolation curve and bezier curve
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: cubic interpolation curve and bezier curve  (Read 534 times)
Bijeoma

myloveiloved
cubic interpolation curve and bezier curve
« on: Aug 18th, 2004, 10:10pm »

whats the difference? its seems as if a bezier curve can produce a cubic interpolation curve or something similar.    i have a set of adjacent points i want to use to create a smooth continous line. the bezier and curve functions use 4 points i want to enter 2 points A and B and let it return however many points between; i want to able to modify the resolution of the curve. any suggestions?
« Last Edit: Aug 18th, 2004, 10:12pm by Bijeoma »  
fjen

WWW
Re: cubic interpolation curve and bezier curve
« Reply #1 on: Aug 18th, 2004, 11:58pm »

(1)
Quote:
i have a set of adjacent points i want to use to create a smooth continous line.

use curveVertex to create a never-ending line.
http://processing.org/reference/curveVertex_.html
Code:

void setup(){size(100,100);}
void draw(){
 beginShape(LINE_STRIP);  
 for (int i=0; i<100; i++){ curveVertex(random(width),random(height));}
 endShape();  
}

 
(2)
Quote:
i want to enter 2 points A and B and let it return however many points between

an object defined only by 2 points is always a straight line ... just a thought.
Quote:
i want to able to modify the resolution of the curve

you'll have to implement your own curve algorithm then. there is no way to have the inbetween-points returned by processing. see below ...
 
fast bezier: http://www.niksula.cs.hut.fi/~hkankaan/Homepages/bezierfast.html
it's implemention is here: http://www.florianjenett.de/p55/bezierfast/  
 
i guess there are better implementations - but this one is said to be fast.
« Last Edit: Aug 19th, 2004, 12:07am by fjen »  
fjen

WWW
Re: cubic interpolation curve and bezier curve
« Reply #2 on: Aug 19th, 2004, 12:20am »

oh, btw. here's a post on the curveVertex minimal number of points:
 
http://processing.org/discourse/yabb/board_Proce55ing_website_b_ugs_action_display_num_1091446764.html
 
... and something on the smoothness of bezier(): Code:
void setup(){size(100,100);}
 
void draw()
{
  bezierSegments(5); // try changing this //
  bezier(0,0,100,50,50,100,100,100);
}
 
Bijeoma

myloveiloved
Re: cubic interpolation curve and bezier curve
« Reply #3 on: Aug 19th, 2004, 12:35am »

thanks alot.
 
fjen

WWW
Re: cubic interpolation curve and bezier curve
« Reply #4 on: Aug 19th, 2004, 1:06pm »

just found this old flash code of mine ... but i can't remember where the original code came from.
 
bezier2D:
http://www.florianjenett.de/p55/bezier2D/
 
Pages: 1 

« Previous topic | Next topic »