PDA

View Full Version : multi-Bezier Curves visualizing

sdyajian
09-13-2007, 02:56 AM
i am new on Opengl, and get confused by the program structure when i want to visualize multi-bezier curves in unique canvas.

you know, there is a example about single Bezier curve visualization.

so which part of the program should i control in order to visualize multi-Bezier curves??

The ctrlpoints array, the glMap1f() in init(), or the glEvalCoord1f()?????

Thanks very much!!!!

cheers,
Kevin

vbovio
09-13-2007, 08:25 AM
I display bezier curves by using pure lines: I do myself the math to generate the points on the curve and just do a vertex array with lines to aproximate the curve, maybe is not what you want but works great for me.

sdyajian
09-14-2007, 03:37 AM
Thanks a lot vbovio.
that is a good suggestion!

sdyajian
11-22-2007, 04:16 AM
hi I programmed like below, but the out put vertex array stay on one specific point. that is why???

for(t=0; t <= 50; t++){
mu = t/50;
mum1 = 1 - mu;
mum13 = mum1*mum1*mum1;
mu3 = mu*mu*mu;
//ai = t/unitcurve;
bezierx[t] = mum13*(0.05+0.15*i)+3*mu*mum1*mum1*(0.05+0.15*i-curveincreaseunit*h[i][j])+3*mu*mu*mum1*(0.05+0.15*i-curveincreaseunit*h[i][j])+mu3*(0.05+0.15*i);
beziery[t] = mum13*(0.05+0.045*j)+3*mu*mum1*mum1*(0.05+0.045*j) +3*mu*mu*mum1*(0.05+0.45*(j+1))+mu3*(0.05+0.045*(j +1))

sdyajian
11-22-2007, 04:24 AM
looking the code in details, like that

for(t=0; t<=100, t++){
double mu, mum1,mum13,mu3;
mu = t/100;
mum1 = 1 - mu;
mum13 = mum1 * mum1 * mum1;
mu3 = mu * mu * mu;

p.x = mum13*p1.x + 3*mu*mum1*mum1*p2.x + 3*mu*mu*mum1*p3.x + mu3*p4.x;
p.y = mum13*p1.y + 3*mu*mum1*mum1*p2.y + 3*mu*mu*mum1*p3.y + mu3*p4.y;
p.z = mum13*p1.z + 3*mu*mum1*mum1*p2.z + 3*mu*mu*mum1*p3.z + mu3*p4.z;
}

Is there any problem here, that makes the algorithm stay on one point??????
my visualizing result is a line.....

I am looking forward to your ideas!!!