Component:Interactive Hidden Line
From DocR21
The Interactive Hidden Line Component (IHL) creates views of ACIS model objects with hidden lines removed. These views can be used for such tasks as visualization and drafting.
IHL calls the ACIS Faceter to facet the model, then uses the 3D mesh of facets to calculate a list of visible and hidden line segments. These line segments can then be displayed. Multiple IHL views can be calculated following a single faceting operation, and hidden line data can be easily attached to the model using attributes, allowing the data to be saved and restored with the rest of the model. Additionally, hidden line data can be output directly to the application for display or other types of processing using output manager classes.
Contents |
Support and Limitations
IHL supports the following model conditions:
- Sheet and solid bodies (may be mixed)
- Manifold and non-manifold bodies
- Intersecting bodies
- Accepts global facet meshes corresponding to bodies or sets of bodies
- Accepts local facet meshes corresponding to portions of bodies
IHL has the following limitations:
- No smoothing is done
Visibility and Views
A hidden line is a line segment corresponding to part of either a model edge or a silhouette edge that is obscured from the camera (viewpoint) by part of the model. Lines on faces that point away from the camera are hidden, for example. A visible line is a line segment that can be seen directly from the camera with no intervening material.
Note: A model edge is a real edge of the model represented by the EDGE class. A silhouette edge is a visualization cue that does not necessarily correspond to a model edge, such as the circular silhouette of a sphere.
Hidden line data is view dependent. Line segments that are hidden in one view may be visible in a different view.
The view to which the data corresponds is identified by a view token that is stored with hidden line data. Multiple sets of hidden line data corresponding to various views can thus be calculated, stored on the model, and passed to the application for display. API functions and Scheme extensions that manipulate hidden line data accept a view token as input.
Hidden line data may be calculated for perspective views, which have a visual vanishing point, (for example parallel railroad tracks that visually merge at a single point in the distance), or orthographic views, which have no such vanishing point. API functions and Scheme extensions that calculate hidden line data accept a perspective flag as input.
Hidden Line Data Generation
The input to IHL is a list of bodies. Some or all of the bodies in a model can be supplied, depending on what the application needs.
To generate hidden line data the application calls the api_ihl_compute function (or the ihl:compute Scheme extension), passing it this list of bodies. IHL sends the bodies to the faceter and gets a corresponding mesh of facets in return. It then uses this mesh to calculate hidden line segment data.
If the application has a pre-calculated mesh of facets, such as a mesh which has been saved on the model at some earlier time, the api_ihl_compute_from_meshes function can be called to generate hidden line data directly from this mesh without calling the faceter again.
Hidden line data always includes visible line segments. It can optionally also include hidden line segments. Visibility information is attached to each segment.
Hidden line segments are output polygon by polygon so they are partially sorted in a natural way. The actual order depends strongly on the faceter.
IHL depends on the planarity of the facets for proper operation. However, the faceter often creates non-planar facets. To avoid errors try to set the faceting refinement so that the facets are as regular and planar as possible. Refer to the Faceting section for more information.
Storing Hidden Line Data on the Model
The api_ihl_compute function (or the ihl:compute Scheme extension) calculates and optionally attaches hidden line data to the model bodies. If the function is called with a nonzero view token, data is attached to the model. If it is called with a view token of zero, no data is attached.
When hidden line data is no longer needed, it can be removed from the model by calling the api_ihl_clean function (or the ihl:clean Scheme extension) with the appropriate view token. Only data with a matching view token is removed, permitting the application to remove one view's hidden line data while retaining other views' data.
Note: Make certain to call api_ihl_clean to free memory when the hidden line data is no longer required.
Hidden line data is attached to the model using attributes. When the model is then saved or restored, the hidden line data accompanies it. The ATTRIB_IHL_VW class attaches interactive hidden line data and viewing parameters to the bodies from which the data was computed. The data is stored as a doubly linked list of IHL_EDGEs that can be queried, and a camera pointer.
Hidden Line Data Output
Hidden line data is output using output manager classes, including IHL_OUTPUT_MANAGER, IHL_STDOUT_MANAGER, and application specific output managers, which can be derived from api_ihl_compute_from_meshes.
Examples
- Scheme code: Scheme command ihl:compute
- Scheme code: option ihl_lines
- Scheme code: option ihl_lines_style
Options
Important: For historical reasons, there are some global options that also affect the behavior of Faceter operations. Refer to Category:Interactive Hidden Line - ACIS Options.
