How to build a circular arc mesh at runtime?

Started by
1 comment, last by z80 18 years, 1 month ago
Hi, I'd like to build a 3D-Environment with DirectX 9 that shows a track built of some 3D-curves such as straight and bended metal rods (circular arcs). The layout of the track is read from an xml-file. The problem is that an arc may have any length and radius. I started with modelling fixed-size meshes for the arcs, but that doesnt't cover all the possibilities (well, it's hard to model an infinite amount of meshes). I also thought of piecing together the arc with simple boxes, but that leads to intersections and gaps. Have you any ideas that could help me building these arcs? Is there maybe a function to create a mesh on device creation by extruding a plane (e.g. the profile of the curve)? The profile is the only thing which is constant. I think drawing arbitrary arcs is a common problem, but I didn't find adequate information yet. Thanks, Jack P.S I'm using MDX, but I think that is not a matter for this problem...
Advertisement
What you're trying to do is sometimes referred to as "Procedural Modelling".

Have you had a look at how the vertices of a cylinder are computed in Tutorials 4 & 5 of the DX9SDK?

Also, Bezier curves and Bezier Patches are more complicated but are a good way of describing curves.

Gamasutra.com has an article with source code.
A Catmull-Rom Spline surface would probably do the trick too.

This topic is closed to new replies.

Advertisement