Build Better Software. Faster.
Visit our company site at: www.techsoft3d.com
 

White Papers Index

Obtaining Accurately Scaled, High Quality HPGL/2 Output
Rob

1. Scaling

HPGL2 files are generally not guaranteed by the HPGL2 spec to be plotter independent. However, the HOOPS HPGL2 driver output files are indeed plotter independent, in the sense that the image will be the same scale on whatever device the file is sent to. (Note: the image will be clipped if the device extents are is smaller than the image.) This behavior is a result of the specific method and type of HPGL2 scaling commands designed into the HPGL2 driver.

To achieve accurate scaling and position on the page, the user must set up a target printable area using the HPGL2 driver options. Then, the camera field would typically be set to the same size to obtain 1:1 scaling (or to a ratio of the printable area, to obtain some other scale factor).

After this target printable area is used to generate the output file, an accurately scaled image will occur on any HPGL2 device, even if its specific printable area does not match the target printable area.

Refer to the HPGL2 section of the HOOPS/3dGS Device Guide for details on the HPGL2 driver usage and it’s various Driver_Options.

2. Printable area

Most printers have an unprintable region around the edge of the piece of paper. This is unlike a display monitor window in which the scene can be displayed to the edge of the window.

The width and height used in the "physical size" and the "locator transform" HPGL2 driver options are the "maximum printable area" size, not the size of the paper. The left, right, bottom, and top values in the "locater transform" option are margin sizes. They start at the maximum printable area (not the paper edge), and extend inward to the target printable area. These margin values are often 0, but can be used to locate a smaller target printable area to a desired location on a larger page.

3. Setup for accurate scaling

As a consequence of the above, the width and height used in the driver options should generally be less than the size of the paper. A good assumption would be a 1.0 cm unprintable border all around. On many devices, the leading and side edges it will be less. On some sheet feed devices, the trailing edge may have a considerably larger border so that the device can hang on to the paper. Of course, if you know the actual values for a specific device and want to control the image location very closely, use those actual values.

As an example, let’s say we have a 2D (z=0) box that is being viewed orthogonally, is intended to measure 5cm x 5cm, and has units in HOOPS world space which range from -2.5 to 2.5 in X and Y. If we want to obtain 1.0 scale output on a device with paper size of 10cm x 20cm and a 1cm border, we would have a physical size of (8, 18) set the camera field to match:

HC_Set_Camera_Field (8.0, 18.0);
HC_Set_Driver_Options ("physical size = (8.0, 18.0)");

For 0.5 scale output, we would double the camera field in both X and Y:

HC_Set_Camera_Field (16.0, 36.0);
HC_Set_Driver_Options ("physical size = (8.0, 18.0)");

The camera extents will be mapped to the ‘viewport’ which in this case is a virtual viewport in the HPGL2 file with extents of 8cm X 18cm.

The resulting output will always have the same scale regardless of the device. However, to achieve a specific positioning of the output on the printed page (for example, in the center), you must use the locator transform option with the correct width and height for the particular output device. Achieving such positioning is device-dependent, and thus the device extents must be known in advance.

4. Rasterized Geometry

Rasterized geometry in this case refers to geometry that is drawn with rendering attributes that are not supported by the underlying device interface. Therefore, the geometry must be broken down into rasters (think of a raster as a scanline in an image.) For HPGL2, as for most 2D devices, any geometry that is smooth-shaded, textured, transparent or color-interpolated will come down as rasters. By default, rasters will be sent to the HPGL2 device/file at a resolution of 72 DPI. However, this can be increased by setting the ‘hardcopy resolution’ Driver_Option. Keep in mind that increasing the resolution will increase the size of the output, which in turn will increase the time required to print the result.

HOOPS/3dGS ‘image’ primitives will also come down as rasters, but as they are fixed-size chunks of rasters, they will not scale on the device. If it is desirable to render a scene that contains images and have those images scale in hardcopy output, then a textured mesh should be substituted in place of the image primitives. This involves inserting a HOOPS/3dGS ‘mesh’ that contains 4 points (a rectangle) and using the image as a texture map to be applied to the mesh. Now the image is being represented by a fully 3d, transformable (scalable) textured object, and any scaling applied to the scene will apply to the object.

 
 

 

 

 

 

©2004-06 Tech Soft 3D All Rights Reserved. Privacy | Legal