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

Draw curve in HP-GL/2

How do I draw a curve using HP-GL/2? What is the command?
0
suhani
Asked:
suhani
  • 2
1 Solution
 
vikiingCommented:
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
 
suhaniAuthor Commented:
Thanks!
0
 
vikiingCommented:
Thanks to you, dude !!

Are you writing a drawing program or what?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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