View Full Version : How to draw arcs in 3D?

martianfighter

06-25-2002, 06:47 PM

I am programming a app about milling. The app displays parts just like UG & pro/E,and I want to display the trajectory of cutter. Now every part of the trajectory is arc or segment. I want to know how to draw arcs in 3D. I need your help!

Thanks a lot!

Devulon

06-26-2002, 03:10 AM

Drawing arcs is a bit funky depending on the actual arc. If it is truely just part of a circle then its just like drawing part of a circle. If it is a little more fancy such as a spline then its slightly more complicated. I am talking about actually drawing it yourself. The 2 basic primitives (lines and circles) are easily drawn with Bresenhams line and circle algorithms. Do a google search if you like to look at math.

This is an opengl forum so I assume you are using opengl. THe problem is that opengl can't draw circles or arcs. THe only thing it can draw is a line. So what you have to do is discretize the circle, arc, or spline into a set of lines. This is really a simple process of simply sampling the coordinates of the shape at small intervals that are close together and drawing lines. When the interval is small enough that the lines are only a few pixels long it will appear to be curved. Its that simple.

If you want more specifics let me know exactly what type of curves you are drawing (whether its a true arc or a spline) and what data you have to work with. Basically how you store your arcs. Be it a point for the center and 2 angles that contain the arc or whatever it is.

Devulon

Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.