/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef _ODHLRALGOBREP_INCLUDED_ #define _ODHLRALGOBREP_INCLUDED_ //#include "OdaCommon.h" #include "HlrAlgoExport.h" #include "Ge/GeCurve2dPtrArray.h" #include "Ge/GeCurve3dPtrArray.h" class OdBrBrep; class OdGeMatrix3d; namespace OdHlrN { class HlrBlock; class HlrAlgoBrepImpl; /** * The main class for hidden line removal algorithmm which finds visible, hidden and occluded * segments of edges based on a view position and direction for BrBrep entities */ class HLRALGO_TOOLKIT_EXPORT HlrAlgoBrep { public: /** \details * Options of PHLR */ struct Options { /** \details * Flag whether to exclude tangent edges. */ bool excludeTangentEdges = false; /** \details * Flag to preserve silhouette tangent edges which tangent edges were excluded. */ bool keepSilhTangentEdges = false; /** \details * Angle to determine if edge is tangent (angle between tangent planes in every point of edge faces in degrees). */ double tgAngle = 6; /** \details * Flag whether to calculate interference edges (interesect surfaces from different bodies). */ bool calcInterference = false; }; /** \details Default constructor for HlrAlgoBrep class. \remarks Projection plane normal vector is (-1,-1,-1) by default. Parameters like projection plane origin and up vector are calculated according to breps 3d extents */ HlrAlgoBrep(); /** \details Constructor for HlrAlgoBrep class by view data \param planeNrml [in] Projection plane normal vector. \param planeOrigin [in] Projection plane origin [optional]. \param upDir [in] Up vector [optional]. \param pWorldToModel [in] Matrix to transform projection plane [optional]. \remarks If optional parameters are not provided they are calculated according to breps 3d extents */ HlrAlgoBrep(const OdGeVector3d& planeNrml, const OdGePoint3d* planeOrigin, OdGeVector3d* upDir, OdGeMatrix3d* pWorldToModel); ~HlrAlgoBrep(); /** \details Creates a block \param transf [in] Block transformation matrix. \param parentBlock [in] Parent block [optional]. \returns a pointer to created block */ HlrBlock* createBlock(const OdGeMatrix3d& transf, HlrBlock* parentBlock = NULL); /** \details Add brep to block \param br [in] Brep to add. \param hlrBlockTo [in] Block to add the brep to [optional]. \returns true if brep is added the first time, otherwise false */ bool addBrep(OdBrBrep& br, HlrBlock* hlrBlockTo = NULL); /** \details Get pointer to top block \returns a pointer to top block */ HlrBlock* getTopBlock() const; /** \details Share the content between blocks \param hlrBlockFrom [in] Block which content should be shared. \param hlrBlockTo [in] Block which gets the new content. */ static void shareBlockContent(const HlrBlock* hlrBlockFrom, HlrBlock* hlrBlockTo); /** \details Sets view data \param planeNrml [in] Projection plane normal vector. \param planeOrigin [in] Projection plane origin [optional]. \param upDir [in] Up vector [optional]. \param pWorldToModel [in] Matrix to transform projection plane [optional]. */ void setViewParams(const OdGeVector3d& planeNrml, OdGePoint3d* planeOrigin, OdGeVector3d* upDir, OdGeMatrix3d* pWorldToModel); /** \details Run PHLR algorithm with provided options \param opts [in] Options. \returns truf if operation success. */ bool run(const Options& opts); /** \details Gets the 3d visible/hidden/occluded curves \param visCurves [out] Visible curves. \param hidCurves [out] Curves hidden by faces. \param occlCurves [out] Curves hidden by other curves (coincident intervals) [optional]. */ void getHlrCurves3d(OdGeCurve3dPtrArray& visCurves, OdGeCurve3dPtrArray* hidCurves, OdGeCurve3dPtrArray* occlCurves); /** \details Gets projection plane origin point. \returns pojection plane origin point. */ const OdGePoint3d& getProjPlaneOrigin() const; /** \details Gets projection plane normal vector. \returns pojection plane normal vector. */ const OdGeVector3d& getProjPlaneNormal() const; /** \details Gets projected 2d visible and hidden curves. \param visCurves [out] Visible curves. \param hidCurves [out] Hidden curves [optional]. */ void getHlrCurves2d(OdGeCurve2dPtrArray& visCurves, OdGeCurve2dPtrArray* hidCurves); /** \details Gets visible and hidden curves on projected plane \param visCurves [out] Visible curves. \param hidCurves [out] Hidden curves [optinal]. */ void getHlrProjCurves3d(OdGeCurve3dPtrArray& visCurves, OdGeCurve3dPtrArray* hidCurves); private: HlrAlgoBrepImpl* m_pImpl; friend class HlrInternal; }; } // namespace OdHlrN #endif //_ODHLRALGO_INCLUDED_