Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-03 09:17:34

0001 // Copyright (c) 2013 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _StdPrs_ToolTriangulatedShape_HeaderFile
0015 #define _StdPrs_ToolTriangulatedShape_HeaderFile
0016 
0017 #include <BRepLib_ToolTriangulatedShape.hxx>
0018 #include <gp_Dir.hxx>
0019 #include <NCollection_Array1.hxx>
0020 
0021 class TopoDS_Shape;
0022 class Prs3d_Drawer;
0023 
0024 class StdPrs_ToolTriangulatedShape : public BRepLib_ToolTriangulatedShape
0025 {
0026 public:
0027   //! Similar to BRepTools::Triangulation() but without extra checks.
0028   //! @return true if all faces within shape are triangulated.
0029   Standard_EXPORT static bool IsTriangulated(const TopoDS_Shape& theShape);
0030 
0031   //! Checks back faces visibility for specified shape (to activate back-face culling).
0032   //! @return true if shape is closed manifold Solid or compound of such Solids.
0033   Standard_EXPORT static bool IsClosed(const TopoDS_Shape& theShape);
0034 
0035   //! Computes the absolute deflection value depending on the type of deflection in theDrawer:
0036   //! <ul>
0037   //! <li><b>Aspect_TOD_RELATIVE</b>: the absolute deflection is computed using the relative
0038   //! deviation coefficient from theDrawer and the shape's bounding box;</li>
0039   //! <li><b>Aspect_TOD_ABSOLUTE</b>: the maximal chordial deviation from theDrawer is
0040   //! returned.</li>
0041   //! </ul>
0042   //! In case of the type of deflection in theDrawer computed relative deflection for shape is
0043   //! stored as absolute deflection. It is necessary to use it later on for sub-shapes. This
0044   //! function should always be used to compute the deflection value for building discrete
0045   //! representations of the shape (triangulation, wireframe) to avoid inconsistencies between
0046   //! different representations of the shape and undesirable visual artifacts.
0047   Standard_EXPORT static double GetDeflection(const TopoDS_Shape&              theShape,
0048                                               const occ::handle<Prs3d_Drawer>& theDrawer);
0049 
0050   //! Checks whether the shape is properly triangulated for a given display settings.
0051   //! @param[in] theShape  the shape.
0052   //! @param[in] theDrawer  the display settings.
0053   Standard_EXPORT static bool IsTessellated(const TopoDS_Shape&              theShape,
0054                                             const occ::handle<Prs3d_Drawer>& theDrawer);
0055 
0056   //! Validates triangulation within the shape and performs tessellation if necessary.
0057   //! @param[in] theShape  the shape.
0058   //! @param[in] theDrawer  the display settings.
0059   //! @return true if tessellation was recomputed and false otherwise.
0060   Standard_EXPORT static bool Tessellate(const TopoDS_Shape&              theShape,
0061                                          const occ::handle<Prs3d_Drawer>& theDrawer);
0062 
0063   //! If presentation has own deviation coefficient and IsAutoTriangulation() is true,
0064   //! function will compare actual coefficients with previous values and will clear triangulation on
0065   //! their change (regardless actual tessellation quality). Function is placed here for
0066   //! compatibility reasons - new code should avoid using IsAutoTriangulation().
0067   //! @param[in] theShape   the shape
0068   //! @param[in] theDrawer  the display settings
0069   //! @param[in] theToResetCoeff  updates coefficients in theDrawer to actual state to avoid
0070   //! redundant recomputations
0071   Standard_EXPORT static void ClearOnOwnDeflectionChange(const TopoDS_Shape&              theShape,
0072                                                          const occ::handle<Prs3d_Drawer>& theDrawer,
0073                                                          const bool theToResetCoeff);
0074 };
0075 
0076 #endif