Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-25 09:19:20

0001 // Created on: 2016-04-19
0002 // Copyright (c) 2016 OPEN CASCADE SAS
0003 // Created by: Oleg AGASHIN
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _BRepMesh_ShapeTool_HeaderFile
0017 #define _BRepMesh_ShapeTool_HeaderFile
0018 
0019 #include <Standard_Transient.hxx>
0020 #include <IMeshData_Types.hxx>
0021 #include <Poly_Triangulation.hxx>
0022 #include <Poly_PolygonOnTriangulation.hxx>
0023 
0024 class Geom_Curve;
0025 class Geom2d_Curve;
0026 class Poly_Polygon3D;
0027 class TopoDS_Face;
0028 class TopoDS_Edge;
0029 class Bnd_Box;
0030 
0031 //! Auxiliary class providing functionality to compute,
0032 //! retrieve and store data to TopoDS and model shape.
0033 class BRepMesh_ShapeTool : public Standard_Transient
0034 {
0035 public:
0036   //! Returns maximum tolerance of the given face.
0037   //! Considers tolerances of edges and vertices contained in the given face.
0038   Standard_EXPORT static double MaxFaceTolerance(const TopoDS_Face& theFace);
0039 
0040   //! Gets the maximum dimension of the given bounding box.
0041   //! If the given bounding box is void leaves the resulting value unchanged.
0042   //! @param theBox bounding box to be processed.
0043   //! @param theMaxDimension maximum dimension of the given box.
0044   Standard_EXPORT static void BoxMaxDimension(const Bnd_Box& theBox, double& theMaxDimension);
0045 
0046   //! Checks same parameter, same range and degenerativity attributes
0047   //! using geometrical data of the given edge and updates edge model
0048   //! by computed parameters in case of worst case - it can drop flags
0049   //! same parameter and same range to False but never to True if it is
0050   //! already set to False. In contrary, it can also drop degenerated
0051   //! flag to True, but never to False if it is already set to True.
0052   Standard_EXPORT static void CheckAndUpdateFlags(const IMeshData::IEdgeHandle&   theEdge,
0053                                                   const IMeshData::IPCurveHandle& thePCurve);
0054 
0055   //! Stores the given triangulation into the given face.
0056   //! @param theFace face to be updated by triangulation.
0057   //! @param theTriangulation triangulation to be stored into the face.
0058   Standard_EXPORT static void AddInFace(const TopoDS_Face&               theFace,
0059                                         occ::handle<Poly_Triangulation>& theTriangulation);
0060 
0061   //! Nullifies triangulation stored in the face.
0062   //! @param theFace face to be updated by null triangulation.
0063   Standard_EXPORT static void NullifyFace(const TopoDS_Face& theFace);
0064 
0065   //! Nullifies polygon on triangulation stored in the edge.
0066   //! @param theEdge edge to be updated by null polygon.
0067   //! @param theTriangulation triangulation the given edge is associated to.
0068   //! @param theLocation face location.
0069   Standard_EXPORT static void NullifyEdge(const TopoDS_Edge&                     theEdge,
0070                                           const occ::handle<Poly_Triangulation>& theTriangulation,
0071                                           const TopLoc_Location&                 theLocation);
0072 
0073   //! Nullifies 3d polygon stored in the edge.
0074   //! @param theEdge edge to be updated by null polygon.
0075   //! @param theLocation face location.
0076   Standard_EXPORT static void NullifyEdge(const TopoDS_Edge&     theEdge,
0077                                           const TopLoc_Location& theLocation);
0078 
0079   //! Updates the given edge by the given tessellated representation.
0080   //! @param theEdge edge to be updated.
0081   //! @param thePolygon tessellated representation of the edge to be stored.
0082   //! @param theTriangulation triangulation the given edge is associated to.
0083   //! @param theLocation face location.
0084   Standard_EXPORT static void UpdateEdge(const TopoDS_Edge&                              theEdge,
0085                                          const occ::handle<Poly_PolygonOnTriangulation>& thePolygon,
0086                                          const occ::handle<Poly_Triangulation>& theTriangulation,
0087                                          const TopLoc_Location&                 theLocation);
0088 
0089   //! Updates the given edge by the given tessellated representation.
0090   //! @param theEdge edge to be updated.
0091   //! @param thePolygon tessellated representation of the edge to be stored.
0092   Standard_EXPORT static void UpdateEdge(const TopoDS_Edge&                 theEdge,
0093                                          const occ::handle<Poly_Polygon3D>& thePolygon);
0094 
0095   //! Updates the given seam edge by the given tessellated representations.
0096   //! @param theEdge edge to be updated.
0097   //! @param thePolygon1 tessellated representation corresponding to
0098   //! forward direction of the seam edge.
0099   //! @param thePolygon2 tessellated representation corresponding to
0100   //! reversed direction of the seam edge.
0101   //! @param theTriangulation triangulation the given edge is associated to.
0102   //! @param theLocation face location.
0103   Standard_EXPORT static void UpdateEdge(
0104     const TopoDS_Edge&                              theEdge,
0105     const occ::handle<Poly_PolygonOnTriangulation>& thePolygon1,
0106     const occ::handle<Poly_PolygonOnTriangulation>& thePolygon2,
0107     const occ::handle<Poly_Triangulation>&          theTriangulation,
0108     const TopLoc_Location&                          theLocation);
0109 
0110   //! Applies location to the given point and return result.
0111   //! @param thePnt point to be transformed.
0112   //! @param theLoc location to be applied.
0113   Standard_EXPORT static gp_Pnt UseLocation(const gp_Pnt& thePnt, const TopLoc_Location& theLoc);
0114 
0115   //! Gets the strict UV locations of the extremities of the edge using pcurve.
0116   Standard_EXPORT static bool UVPoints(const TopoDS_Edge& theEdge,
0117                                        const TopoDS_Face& theFace,
0118                                        gp_Pnt2d&          theFirstPoint2d,
0119                                        gp_Pnt2d&          theLastPoint2d,
0120                                        const bool         isConsiderOrientation = false);
0121 
0122   //! Gets the parametric range of the given edge on the given face.
0123   Standard_EXPORT static bool Range(const TopoDS_Edge&         theEdge,
0124                                     const TopoDS_Face&         theFace,
0125                                     occ::handle<Geom2d_Curve>& thePCurve,
0126                                     double&                    theFirstParam,
0127                                     double&                    theLastParam,
0128                                     const bool                 isConsiderOrientation = false);
0129 
0130   //! Gets the 3d range of the given edge.
0131   Standard_EXPORT static bool Range(const TopoDS_Edge&       theEdge,
0132                                     occ::handle<Geom_Curve>& theCurve,
0133                                     double&                  theFirstParam,
0134                                     double&                  theLastParam,
0135                                     const bool               isConsiderOrientation = false);
0136 
0137   DEFINE_STANDARD_RTTIEXT(BRepMesh_ShapeTool, Standard_Transient)
0138 };
0139 
0140 #endif