Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-27 09:42:22

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 Standard_Real 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,
0045                                               Standard_Real& theMaxDimension);
0046 
0047   //! Checks same parameter, same range and degenerativity attributes
0048   //! using geometrical data of the given edge and updates edge model
0049   //! by computed parameters in case of worst case - it can drop flags
0050   //! same parameter and same range to False but never to True if it is
0051   //! already set to False. In contrary, it can also drop degenerated
0052   //! flag to True, but never to False if it is already set to True.
0053   Standard_EXPORT static void CheckAndUpdateFlags(const IMeshData::IEdgeHandle&   theEdge,
0054                                                   const IMeshData::IPCurveHandle& thePCurve);
0055 
0056   //! Stores the given triangulation into the given face.
0057   //! @param theFace face to be updated by triangulation.
0058   //! @param theTriangulation triangulation to be stored into the face.
0059   Standard_EXPORT static void AddInFace(const TopoDS_Face&          theFace,
0060                                         Handle(Poly_Triangulation)& theTriangulation);
0061 
0062   //! Nullifies triangulation stored in the face.
0063   //! @param theFace face to be updated by null triangulation.
0064   Standard_EXPORT static void NullifyFace(const TopoDS_Face& theFace);
0065 
0066   //! Nullifies polygon on triangulation stored in the edge.
0067   //! @param theEdge edge to be updated by null polygon.
0068   //! @param theTriangulation triangulation the given edge is associated to.
0069   //! @param theLocation face location.
0070   Standard_EXPORT static void NullifyEdge(const TopoDS_Edge&                theEdge,
0071                                           const Handle(Poly_Triangulation)& theTriangulation,
0072                                           const TopLoc_Location&            theLocation);
0073 
0074   //! Nullifies 3d polygon stored in the edge.
0075   //! @param theEdge edge to be updated by null polygon.
0076   //! @param theLocation face location.
0077   Standard_EXPORT static void NullifyEdge(const TopoDS_Edge&     theEdge,
0078                                           const TopLoc_Location& theLocation);
0079 
0080   //! Updates the given edge by the given tessellated representation.
0081   //! @param theEdge edge to be updated.
0082   //! @param thePolygon tessellated representation of the edge to be stored.
0083   //! @param theTriangulation triangulation the given edge is associated to.
0084   //! @param theLocation face location.
0085   Standard_EXPORT static void UpdateEdge(const TopoDS_Edge&                         theEdge,
0086                                          const Handle(Poly_PolygonOnTriangulation)& thePolygon,
0087                                          const Handle(Poly_Triangulation)& theTriangulation,
0088                                          const TopLoc_Location&            theLocation);
0089 
0090   //! Updates the given edge by the given tessellated representation.
0091   //! @param theEdge edge to be updated.
0092   //! @param thePolygon tessellated representation of the edge to be stored.
0093   Standard_EXPORT static void UpdateEdge(const TopoDS_Edge&            theEdge,
0094                                          const Handle(Poly_Polygon3D)& thePolygon);
0095 
0096   //! Updates the given seam edge by the given tessellated representations.
0097   //! @param theEdge edge to be updated.
0098   //! @param thePolygon1 tessellated representation corresponding to
0099   //! forward direction of the seam edge.
0100   //! @param thePolygon2 tessellated representation corresponding to
0101   //! reversed direction of the seam edge.
0102   //! @param theTriangulation triangulation the given edge is associated to.
0103   //! @param theLocation face location.
0104   Standard_EXPORT static void UpdateEdge(const TopoDS_Edge&                         theEdge,
0105                                          const Handle(Poly_PolygonOnTriangulation)& thePolygon1,
0106                                          const Handle(Poly_PolygonOnTriangulation)& thePolygon2,
0107                                          const 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 Standard_Boolean UVPoints(
0117     const TopoDS_Edge&     theEdge,
0118     const TopoDS_Face&     theFace,
0119     gp_Pnt2d&              theFirstPoint2d,
0120     gp_Pnt2d&              theLastPoint2d,
0121     const Standard_Boolean isConsiderOrientation = Standard_False);
0122 
0123   //! Gets the parametric range of the given edge on the given face.
0124   Standard_EXPORT static Standard_Boolean Range(
0125     const TopoDS_Edge&     theEdge,
0126     const TopoDS_Face&     theFace,
0127     Handle(Geom2d_Curve)&  thePCurve,
0128     Standard_Real&         theFirstParam,
0129     Standard_Real&         theLastParam,
0130     const Standard_Boolean isConsiderOrientation = Standard_False);
0131 
0132   //! Gets the 3d range of the given edge.
0133   Standard_EXPORT static Standard_Boolean Range(
0134     const TopoDS_Edge&     theEdge,
0135     Handle(Geom_Curve)&    theCurve,
0136     Standard_Real&         theFirstParam,
0137     Standard_Real&         theLastParam,
0138     const Standard_Boolean isConsiderOrientation = Standard_False);
0139 
0140   DEFINE_STANDARD_RTTIEXT(BRepMesh_ShapeTool, Standard_Transient)
0141 };
0142 
0143 #endif