• Status: Solved
• Priority: Medium
• Security: Public
• Views: 335

# Draw curve in HP-GL/2

How do I draw a curve using HP-GL/2? What is the command?
0
suhani
• 2
1 Solution

Commented:
You have no direct way to draw a generic curve; you must have the whole sequence of points that conform the curve, so you can draw each portion as a line segment, something like this:

PU x0,y0; PD x1,y1; x2,y2; x3,y3; ... xn, yn;

That makes a pen up (no draw) and move up to coordinates (x0,y0), the first point of the curve. Then, make a pen down (draw) and move up to (x1,y1); from there, continue up to (x2,y2), etc..

Of course, points must be close enough to have a good resolution. If not, you must use special algorithms known as "Bèzier curve", or "B-Spline", which let you compute a mean curve knowing only the extreme points, a marvelous way of solving a curve in order to minimize saw-tooth effect (i.e.: when you apply a big zoom factor to a piece of image).

0

Author Commented:
Thanks!
0

Commented:
Thanks to you, dude !!

Are you writing a drawing program or what?
0

## Featured Post

• 2
Tackle projects and never again get stuck behind a technical roadblock.