View Full Version : Bezier Question

agentsim

06-12-2003, 07:58 PM

I am trying to make a roller coster simulator.

In order to make my track look very nice and smooth, I want to use bezier curves to produce it. I understand how to make a bezier line, and I understand how to make a bezier surface... but how would I take a circle, and draw it along a set of bezier curves to generate a arbitrartily warped cylinder?

Any help is much appreciated...

Cheers,

-Agentsim

PS : Does anyone know of a tool that can automatically convert parametric (or other) equations into bezier segments with control points?

Hello,

I did something like this to make a train track for a project I was working on. I defined a section of a train-track with a bezier curve and a cross-section that I swept along the curve to extrude a solid. (The cross section was not circular, but it's the same idea).

My approach was to define a set of strips. I took my cross section (your circle in this case) and broke it into a polygon representation. I then took two adjacent verticies and swept them along the path. I did this by dividing my path into sections (c.f. note later) and computing the 3D point and the derivative along the path. (Its easy to compute the derivative of the bezier function.) You can compute a vector orthogonal to the derivative; the idea is that the cross section lies on the plane defined by the 3D point and the normal==the derivative of that point. You map the two points for each strip onto the plane, and do this for as many planes as you want through the curve.

This works, but there are problems with it. What happens if the curve is too sharp that the planes intersect? You want to do some kind of polygon welding to smooth out the inconsistencies. However, I think it'll work for your rollercoaster.

hoep this helps

cheers

John

Ridge

06-12-2003, 08:33 PM

You may want to look into GLE, the GL extrusion and tubing library...

http://linas.org/gle/

agentsim

06-13-2003, 04:08 AM

Thanks John,

The only thing I'm having trouble getting my head around is whether or not bezier curves are really needed for what I'm doing.

Basically from what you wrote I get the impression that I am simply creating a function to draw quads or even quad strips along a given path. I could define the path using sections of parametric functions, and ensure that the 3D point and derivative are equal at intersection.

The reason I shyed away from that approach in the beginning was because I thought the resulting polygon count would be prohibitvely high (with lighting + textures). Obviously, the smoother the surface the more quads I need.

Also, you suggest I use a bezier curve to model the track, that I understand. However, you did not mention using the control points of the curve to extrude the cross-section. Is that because for any two adjacent vertices, you cannot easily calculate a control point that will preserve the cross-section? If so, is modeling the track with bezier simply to ensure that the component sections are defined by simple polynomials, as opposed to sin/cos (making derivative calculations faster)?

Thanks again,

-Agentsim

Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.