Skip to content

Hidden Line Removal Module

Hidden line removal for technical drawings and wireframe visualization.

LightOcct::LHLR

Hidden Line Removal (HLR) computation class.

Provides a comprehensive wrapper around OCCT's Hidden Line Removal functionality, supporting both exact BRep-based computation (HLRBRep_Algo) and fast polygonal approximation (HLRBRep_PolyAlgo). The class follows the Light OCCT enum + Handle pattern for type-safe OCCT object storage with coordinate system-based POD structures. HLR computation determines which edges of a 3D shape are visible or hidden when viewed from a specific projection. This is essential for technical drawings, wireframe visualization, and 2D projections of 3D models. Example usage: //CreateHLRprocessor auto hlr=(); LHLR::CreateBRepAlgo //Setupperspectiveprojection HLRProjectorDataprojector(, HLR_PERSPECTIVE Point(10,10,10), //eyeposition Point(0,0,0), //target Vector(0,0,1)); //updirection hlr.SetProjector(projector); //Addshapetoprocess LShapeshape=...; //your3Dshape hlr.AddShape(shape); //Configurealgorithmparameters HLRAlgorithmDataconfig; config.WithHidden= true ; config.WithOutline= true ; hlr.SetAlgorithmConfiguration(config); //ComputeHLR HLRResultDataresult=hlr.Compute(); //Accessresults for ( const auto &edge:result.VisibleEdges){ //Processvisibleedges... } for ( const auto &edge:result.HiddenEdges)

cpp
#include <light-occt/hlr/LHLR.hxx>

Quick Reference

Fields: myType, myProjectorData, myAlgorithmData

Factory Methods: CreateBRepAlgo(), CreatePolyAlgo()

Methods: GetType(), IsValid(), SetProjector(), SetParallelProjection(), SetPerspectiveProjection(), GetProjectorData(), AddShape(), RemoveShape(), ClearShapes(), GetNumberOfShapes(), SetAlgorithmConfiguration(), GetAlgorithmConfiguration(), SetWithHidden(), SetWithOutline(), SetWithSmooth(), SetTolerance(), Compute(), IsComputed(), GetLastStatistics(), GetVisibleEdges(), GetHiddenEdges(), GetOutlineEdges(), GetEdgesByType(), Update(), GetProjectedBounds(), ProjectPoint(), ProjectPoints(), LHLR(), ~LHLR(), LHLR(), operator=()

Enums: HLRType


Fields

myType

cpp
HLRType myType;

myProjectorData

cpp
HLRProjectorData myProjectorData;

myAlgorithmData

cpp
HLRAlgorithmData myAlgorithmData;

Methods

Factory Methods

CreateBRepAlgo

Create BRep-based HLR processor.

cpp
static LHLR CreateBRepAlgo();

Creates an exact HLR algorithm processor using HLRBRep_Algo. This provides precise hidden line removal based on the exact BRep geometry but is slower than the polygonal algorithm. processor configured for BRep-based computation LHLR

CreatePolyAlgo

Create polygonal HLR processor.

cpp
static LHLR CreatePolyAlgo(double angularTolerance);

Creates a fast HLR algorithm processor using HLRBRep_PolyAlgo. This provides approximate hidden line removal based on polygonal triangulation of the geometry, trading precision for performance. angularTolerance Angular tolerance for polygonal approximation (radians) processor configured for polygonal computation LHLR

Parameters:

  • angularTolerance - Angular tolerance for polygonal approximation (radians) processor configured for polygonal computation LHLR

Instance Methods

GetType

Get the type of HLR processor.

cpp
HLRType GetType() const;

HLR processor type (BREP_ALGO, POLY_ALGO, or UNDEFINED)

IsValid

Check if HLR processor is valid.

cpp
bool IsValid() const;

true if processor is properly initialized, false otherwise

SetProjector

Set HLR projector configuration.

cpp
bool SetProjector(const  & HLRProjectorData projectorData) const;

Defines the viewing parameters for HLR computation including camera position, target point, projection type (perspective/parallel), and transformation matrices. projectorData Complete projector configuration true if projector was set successfully, false otherwise

Parameters:

  • projectorData - Complete projector configuration true if projector was set successfully, false otherwise
SetParallelProjection

Set parallel (orthogonal) projection.

cpp
bool SetParallelProjection(const  & Vector viewDirection, const  & Vector upDirection) const;

Configures the HLR processor for parallel projection with specified view direction. This is commonly used for technical drawings and engineering views. viewDirection Direction of parallel projection (normalized) upDirection Up direction vector (normalized) true if projection was set successfully, false otherwise

Parameters:

  • viewDirection - Direction of parallel projection (normalized) upDirection Up direction vector (normalized) true if projection was set successfully, false otherwise
  • upDirection - Up direction vector (normalized) true if projection was set successfully, false otherwise
SetPerspectiveProjection

Set perspective projection.

cpp
bool SetPerspectiveProjection(const  & Point eyePosition, const  & Point targetPosition, const  & Vector upDirection, double focusLength) const;

Configures the HLR processor for perspective projection with specified camera parameters. This creates realistic 3D projections with foreshortening effects. eyePosition Camera/eye position in 3D space targetPosition Target point being viewed upDirection Up direction vector (normalized) focusLength Distance from eye to projection plane true if projection was set successfully, false otherwise

Parameters:

  • eyePosition - Camera/eye position in 3D space targetPosition Target point being viewed upDirection Up direction vector (normalized) focusLength Distance from eye to projection plane true if projection was set successfully, false otherwise
  • targetPosition - Target point being viewed upDirection Up direction vector (normalized) focusLength Distance from eye to projection plane true if projection was set successfully, false otherwise
  • upDirection - Up direction vector (normalized) focusLength Distance from eye to projection plane true if projection was set successfully, false otherwise
  • focusLength - Distance from eye to projection plane true if projection was set successfully, false otherwise
GetProjectorData

Get current projector configuration.

cpp
HLRProjectorData GetProjectorData() const;

Copy of current projector data

AddShape

Add shape to HLR computation.

cpp
bool AddShape(const  & LShape shape) const;

Adds a 3D shape to the HLR processor for hidden line removal computation. Multiple shapes can be added and will be processed together. shape 3D shape to process true if shape was added successfully, false otherwise

Parameters:

  • shape - to the HLR processor for hidden line removal computation.
RemoveShape

Remove shape from HLR computation.

cpp
bool RemoveShape(const  & LShape shape) const;

Removes a previously added shape from the HLR processor. shape Shape to remove true if shape was removed successfully, false otherwise

Parameters:

  • shape - from the HLR processor.
ClearShapes

Clear all shapes from HLR computation.

cpp
void ClearShapes() const;

Removes all previously added shapes from the HLR processor.

GetNumberOfShapes

Get number of shapes currently in HLR processor.

cpp
int GetNumberOfShapes() const;

Number of shapes added for processing

SetAlgorithmConfiguration

Set HLR algorithm configuration.

cpp
void SetAlgorithmConfiguration(const  & HLRAlgorithmData algorithmData) const;

Configures algorithm parameters including which edge types to compute, tolerances, and algorithm-specific settings. algorithmData Complete algorithm configuration

Parameters:

  • algorithmData - Complete algorithm configuration
GetAlgorithmConfiguration

Get current algorithm configuration.

cpp
HLRAlgorithmData GetAlgorithmConfiguration() const;

Copy of current algorithm configuration

SetWithHidden

Enable/disable hidden edge computation.

cpp
void SetWithHidden(bool withHidden) const;

withHidden true to include hidden edges in results

Parameters:

  • withHidden - true to include hidden edges in results
SetWithOutline

Enable/disable outline edge computation.

cpp
void SetWithOutline(bool withOutline) const;

withOutline true to include outline/silhouette edges in results

Parameters:

  • withOutline - true to include outline/silhouette edges in results
SetWithSmooth

Enable/disable smooth edge computation.

cpp
void SetWithSmooth(bool withSmooth) const;

withSmooth true to include smooth edges in results

Parameters:

  • withSmooth - true to include smooth edges in results
SetTolerance

Set geometric tolerance for HLR computation.

cpp
void SetTolerance(double tolerance) const;

tolerance Geometric tolerance value

Parameters:

  • tolerance - Geometric tolerance value
Compute

Perform HLR computation.

cpp
HLRResultData Compute() const;

Executes the hidden line removal algorithm on all added shapes using the current projector and algorithm configuration. Returns comprehensive results including visible, hidden, outline, and other edge types. Complete HLR computation results

IsComputed

Check if HLR computation has been performed.

cpp
bool IsComputed() const;

true if has been called successfully Compute()

GetLastStatistics

Get last computation statistics.

cpp
HLRStatistics GetLastStatistics() const;

Statistics from last HLR computation

GetVisibleEdges

Get visible edges from last computation.

cpp
std::vector<  > HLREdgeData GetVisibleEdges() const;

of visible edge data Vector

GetHiddenEdges

Get hidden edges from last computation.

cpp
std::vector<  > HLREdgeData GetHiddenEdges() const;

of hidden edge data Vector

GetOutlineEdges

Get outline edges from last computation.

cpp
std::vector<  > HLREdgeData GetOutlineEdges() const;

of outline/silhouette edge data Vector

GetEdgesByType

Get all edges of specified type.

cpp
std::vector<  > HLREdgeData GetEdgesByType(HLREdgeType edgeType) const;

edgeType Type of edges to retrieve of edge data for specified type Vector

Parameters:

  • edgeType - Type of edges to retrieve of edge data for specified type Vector
Update

Update computation after parameter changes.

cpp
HLROperationInfo Update() const;

Updates the HLR computation without full recomputation when only projector parameters have changed (not shapes or major algorithm settings). HLR operation result information

GetProjectedBounds

Get 2D bounding box of projected results.

cpp
BoundingBox GetProjectedBounds() const;

Bounding box of all edges in projection plane

ProjectPoint

Transform 3D point to 2D projection coordinates.

cpp
Point2d ProjectPoint(const  & Point point3D) const;

point3D 3D point to transform 2D point in projection plane

Parameters:

  • point3D - 3D point to transform 2D point in projection plane
ProjectPoints

Transform 3D points to 2D projection coordinates.

cpp
std::vector<  > Point2d ProjectPoints(const std::vector<  > & Point points3D) const;

points3D of 3D points to transform Vector of 2D points in projection plane Vector

Parameters:

  • points3D - of 3D points to transform Vector of 2D points in projection plane Vector
LHLR

Default constructor creates undefined HLR processor.

cpp
 LHLR() const;
~LHLR

Destructor.

cpp
 ~LHLR() const;
LHLR

Copy constructor.

cpp
 LHLR(const  & LHLR other) const;

other HLR processor to copy

Parameters:

  • other - HLR processor to copy
operator=

Assignment operator.

cpp
& LHLR operator=(const  & LHLR other) const;

other HLR processor to assign Reference to this processor

Parameters:

  • other - HLR processor to assign Reference to this processor

Enumerations

HLRType

HLR processor type enumeration. Defines which OCCT HLR algorithm is being used internally.

cpp
enum HLRType {
    HLR_BREP_ALGO, // Uses HLRBRep_Algo (exact BRep-based algorithm)
    HLR_POLY_ALGO, // Uses HLRBRep_PolyAlgo (polygonal mesh-based algorithm)
    HLR_UNDEFINED, // Invalid/undefined HLR processor.
};

Released under the LGPL-2.1 License