hardcopy_overview(3)

πŸ“¦ version 2.5.0, in fedora 43, fedora 44

πŸŽ€ NAME πŸŽ€

okay bestie, welcome to hardcopy_overview(3) β€” straight outta the Library Functions Manual, and it's giving documentation but make it cute ✨

  • hardcopy_overview β€” an overview of the hardcopy support. that's the whole name, no notes πŸ’…

🌸 DESCRIPTION 🌸

okay so. the main API for HardCopy support in Coin is the abstract class SoVectorizeAction. and what does this icon do? SoVectorizeAction will extract geometry from an Inventor scene graph, and project the geometry onto a specified page. main character energy fr fr πŸ‘‘

but here's the tea you need to know: since postscript and other vector based file formats do not support z-buffer or depth clipping, all geometry is rendered using a simple painter's algorithm β€” meaning the geometry is sorted based on distance to camera. no depth shenanigans, just vibes and sorting 🎨

SoVectorizePSAction inherits SoVectorizeAction, and will output a Postscript file. periodt πŸ–¨οΈ

texture-mapped polygons are not supported, since this is not supported by the vector file formats β€” at least it's not supported in Postscript. 😭 and Gouraud shading is not supported in the Postscript language (at least not for V2.0), BUT an approximation is implemented using an algorithm that divides the triangle into several small (flat-shaded) triangles. the gouraud shading quality (aka the number of sub-triangles) is controlled by an epsilon value. the gouraud shading function is written by Frederic Delhoume (delhoume (at) ilog.fr), and is free (public domain) software. we love a generous icon 🫢

typical use of SoVectorizePSAction is shown in the following piece of code:

SoVectorizePSAction * ps = new SoVectorizePSAction;
SoVectorizeOutput * out = ps->getOutput();

if (!out->openFile("output.ps")) {
  return -1; // unable to open output file
}

// to enable gouraud shading. 0.1 is a nice epsilon value
// ps->setGouraudThreshold(0.1f);

// clear to white background. Not really necessary if you
// want a white background
ps->setBackgroundColor(TRUE, SbColor(1.0f, 1.0f, 1.0f));

// select LANDSCAPE or PORTRAIT orientation
ps->setOrientation(SoVectorizeAction::LANDSCAPE);

// start creating a new page (A4 page, with 10mm border).
ps->beginPage(SbVec2f(10.0f, 10.0f), SbVec2f(190.0f, 277.0f));

// There are also enums for A0-A10. Example:
// ps->beginStandardPage(SoVectorizeAction::A4, 10.0f);

// calibrate so that text, lines, points and images will have the
// same size in the postscript file as on the monitor.
ps->calibrate(viewer->getViewportRegion());

// apply action on the viewer scenegraph. Remember to use
// SoSceneManager's scene graph so that the camera is included.
ps->apply(viewer->getSceneManager()->getSceneGraph());

// this will create the postscript file
ps->endPage();

// close file
out->closeFile();

delete ps;

it is also possible to have several viewports and/or layers on a page. this is useful if your application has several layers of geometry β€” for instance some annotations in 2D on top of a 3D scene graph. to create several layers, the beginViewport() and endViewport() functions can be used. layers?? we love layers πŸ’–

πŸ’œ Since πŸ’œ

Coin 2.1 β€” that's the era, bestie ✨

TGS provides HardCopy support as a separate extension for TGS Inventor.


ngl this whole page is basically "vector formats don't do depth, so we sort, and also here's how you make a .ps" and honestly? iconic.

and that's the whole page, babe β€” this was hardcopy_overview(3) from Coin, Version 2.5.0, and yes it's the Library Functions Manual one. go make some postscript πŸ¦‹πŸ’–βœ¨

πŸ“¦ where this page comes from