Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:00

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 <TColgp_Array1OfDir.hxx>
0019 
0020 class TopoDS_Shape;
0021 class Prs3d_Drawer;
0022 
0023 class StdPrs_ToolTriangulatedShape: public BRepLib_ToolTriangulatedShape
0024 {
0025 public:
0026 
0027   //! Similar to BRepTools::Triangulation() but without extra checks.
0028   //! @return true if all faces within shape are triangulated.
0029   Standard_EXPORT static Standard_Boolean IsTriangulated (const TopoDS_Shape& theShape);
0030 
0031   //! Checks back faces visibility for specified shape (to activate back-face culling). <br>
0032   //! @return true if shape is closed manifold Solid or compound of such Solids. <br>
0033   Standard_EXPORT static Standard_Boolean 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 returned.</li>
0040   //! </ul>
0041   //! In case of the type of deflection in theDrawer computed relative deflection for shape is stored as absolute deflection.
0042   //! It is necessary to use it later on for sub-shapes.
0043   //! This function should always be used to compute the deflection value for building
0044   //! discrete representations of the shape (triangulation, wireframe) to avoid inconsistencies
0045   //! between different representations of the shape and undesirable visual artifacts.
0046   Standard_EXPORT static Standard_Real GetDeflection (const TopoDS_Shape& theShape,
0047                                                       const Handle(Prs3d_Drawer)& theDrawer);
0048 
0049   //! Checks whether the shape is properly triangulated for a given display settings.
0050   //! @param theShape [in] the shape.
0051   //! @param theDrawer [in] the display settings.
0052   Standard_EXPORT static Standard_Boolean IsTessellated (const TopoDS_Shape& theShape,
0053                                                          const Handle(Prs3d_Drawer)& theDrawer);
0054 
0055   //! Validates triangulation within the shape and performs tessellation if necessary.
0056   //! @param theShape [in] the shape.
0057   //! @param theDrawer [in] the display settings.
0058   //! @return true if tessellation was recomputed and false otherwise.
0059   Standard_EXPORT static Standard_Boolean Tessellate (const TopoDS_Shape& theShape,
0060                                                       const Handle(Prs3d_Drawer)& theDrawer);
0061 
0062   //! If presentation has own deviation coefficient and IsAutoTriangulation() is true,
0063   //! function will compare actual coefficients with previous values and will clear triangulation on their change
0064   //! (regardless actual tessellation quality).
0065   //! Function is placed here for compatibility reasons - new code should avoid using IsAutoTriangulation().
0066   //! @param theShape  [in] the shape
0067   //! @param theDrawer [in] the display settings
0068   //! @param theToResetCoeff [in] updates coefficients in theDrawer to actual state to avoid redundant recomputations
0069   Standard_EXPORT static void ClearOnOwnDeflectionChange (const TopoDS_Shape& theShape,
0070                                                           const Handle(Prs3d_Drawer)& theDrawer,
0071                                                           const Standard_Boolean theToResetCoeff);
0072 
0073 };
0074 
0075 #endif