|
Author |
Topic: Moving along 3d bezier (Read 365 times) |
|
Captain_Lobotomy
|
Moving along 3d bezier
« on: Sep 9th, 2003, 10:53pm » |
|
Hi, is there a simple way of retrieving the coordinates of any point on a 3d bezier curve defined by two points and two control points? Seeya, Captlobo
|
|
|
|
Captain_Lobotomy
|
Re: Moving along 3d bezier
« Reply #1 on: Sep 10th, 2003, 6:42pm » |
|
Oops, just found out this functionality is actually build in. Nevr mind...
|
|
|
|
Jerronimo
|
Re: Moving along 3d bezier
« Reply #2 on: Sep 10th, 2003, 9:14pm » |
|
how is this done?
|
|
|
|
Captain_Lobotomy
|
Re: Moving along 3d bezier
« Reply #3 on: Sep 10th, 2003, 9:59pm » |
|
Well assume you defined a simple 3d Bezier as follows: beginShape(LINE_STRIP); bezierVertex(x1, y1, z1); //first point bezierVertex(x2, y2, z2); //first control handle bezierVertex(x3, y3, z3); //second control handle bezierVertex(x4, y4,z4); //second point endShape(); Then you can access any point(x,y,z) on the curve with: x=bezier(x1,x2,x3,x4,t); //t=0..1 x=bezier(y1,y2,y3,y4,t); x=bezier(z1,z2,z3,z4,t); t=0 gives you the starting point, t=1 the endpoint, .. I used this in my first ever applet: http://users.skynet.be/frederikenhermine/ Seeya, FVH
|
|
|
|
pollux
|
Re: Moving along 3d bezier
« Reply #4 on: Sep 10th, 2003, 11:49pm » |
|
beautiful applet, i love the pace. it seems like a parallel universe...
|
pollux | www.frwrd.net
|
|
|
Jerronimo
|
Re: Moving along 3d bezier
« Reply #5 on: Sep 11th, 2003, 4:57am » |
|
neat. i didn't know about that. the documentation has the 't' option in there (time?) but doesn't explain it. where did you learn about that use of bezier()?
|
|
|
|
|