1 // Created on: 2016-04-19 2 // Copyright (c) 2016 OPEN CASCADE SAS 3 // Created by: Oleg AGASHIN 4 // 5 // This file is part of Open CASCADE Technology software library. 6 // 7 // This library is free software; you can redistribute it and/or modify it under 8 // the terms of the GNU Lesser General Public License version 2.1 as published 9 // by the Free Software Foundation, with special exception defined in the file 10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 11 // distribution for complete text of the license and disclaimer of any warranty. 12 // 13 // Alternatively, this file may be used under the terms of Open CASCADE 14 // commercial license or contractual agreement. 15 16 #ifndef _BRepMesh_ShapeTool_HeaderFile 17 #define _BRepMesh_ShapeTool_HeaderFile 18 19 #include <Standard_Transient.hxx> 20 #include <Standard_Handle.hxx> 21 #include <Standard_Type.hxx> 22 #include <IMeshData_Types.hxx> 23 #include <Poly_Triangulation.hxx> 24 #include <Poly_PolygonOnTriangulation.hxx> 25 26 class Geom_Curve; 27 class Geom2d_Curve; 28 class Poly_Polygon3D; 29 class TopoDS_Face; 30 class TopoDS_Edge; 31 class Bnd_Box; 32 33 //! Auxiliary class providing functionality to compute, 34 //! retrieve and store data to TopoDS and model shape. 35 class BRepMesh_ShapeTool : public Standard_Transient 36 { 37 public: 38 39 //! Returns maximum tolerance of the given face. 40 //! Considers tolerances of edges and vertices contained in the given face. 41 Standard_EXPORT static Standard_Real MaxFaceTolerance( 42 const TopoDS_Face& theFace); 43 44 //! Gets the maximum dimension of the given bounding box. 45 //! If the given bounding box is void leaves the resulting value unchanged. 46 //! @param theBox bounding box to be processed. 47 //! @param theMaxDimension maximum dimension of the given box. 48 Standard_EXPORT static void BoxMaxDimension(const Bnd_Box& theBox, 49 Standard_Real& theMaxDimension); 50 51 //! Checks same parameter, same range and degenerativity attributes 52 //! using geometrical data of the given edge and updates edge model 53 //! by computed parameters in case of worst case - it can drop flags 54 //! same parameter and same range to False but never to True if it is 55 //! already set to False. In contrary, it can also drop degenerated 56 //! flag to True, but never to False if it is already set to True. 57 Standard_EXPORT static void CheckAndUpdateFlags ( 58 const IMeshData::IEdgeHandle& theEdge, 59 const IMeshData::IPCurveHandle& thePCurve); 60 61 //! Stores the given triangulation into the given face. 62 //! @param theFace face to be updated by triangulation. 63 //! @param theTriangulation triangulation to be stored into the face. 64 Standard_EXPORT static void AddInFace( 65 const TopoDS_Face& theFace, 66 Handle(Poly_Triangulation)& theTriangulation); 67 68 //! Nullifies triangulation stored in the face. 69 //! @param theFace face to be updated by null triangulation. 70 Standard_EXPORT static void NullifyFace (const TopoDS_Face& theFace); 71 72 //! Nullifies polygon on triangulation stored in the edge. 73 //! @param theEdge edge to be updated by null polygon. 74 //! @param theTriangulation triangulation the given edge is associated to. 75 //! @param theLocation face location. 76 Standard_EXPORT static void NullifyEdge ( 77 const TopoDS_Edge& theEdge, 78 const Handle (Poly_Triangulation)& theTriangulation, 79 const TopLoc_Location& theLocation); 80 81 //! Nullifies 3d polygon stored in the edge. 82 //! @param theEdge edge to be updated by null polygon. 83 //! @param theLocation face location. 84 Standard_EXPORT static void NullifyEdge ( 85 const TopoDS_Edge& theEdge, 86 const TopLoc_Location& theLocation); 87 88 //! Updates the given edge by the given tessellated representation. 89 //! @param theEdge edge to be updated. 90 //! @param thePolygon tessellated representation of the edge to be stored. 91 //! @param theTriangulation triangulation the given edge is associated to. 92 //! @param theLocation face location. 93 Standard_EXPORT static void UpdateEdge ( 94 const TopoDS_Edge& theEdge, 95 const Handle (Poly_PolygonOnTriangulation)& thePolygon, 96 const Handle (Poly_Triangulation)& theTriangulation, 97 const TopLoc_Location& theLocation); 98 99 //! Updates the given edge by the given tessellated representation. 100 //! @param theEdge edge to be updated. 101 //! @param thePolygon tessellated representation of the edge to be stored. 102 Standard_EXPORT static void UpdateEdge( 103 const TopoDS_Edge& theEdge, 104 const Handle(Poly_Polygon3D)& thePolygon); 105 106 //! Updates the given seam edge by the given tessellated representations. 107 //! @param theEdge edge to be updated. 108 //! @param thePolygon1 tessellated representation corresponding to 109 //! forward direction of the seam edge. 110 //! @param thePolygon2 tessellated representation corresponding to 111 //! reversed direction of the seam edge. 112 //! @param theTriangulation triangulation the given edge is associated to. 113 //! @param theLocation face location. 114 Standard_EXPORT static void UpdateEdge ( 115 const TopoDS_Edge& theEdge, 116 const Handle (Poly_PolygonOnTriangulation)& thePolygon1, 117 const Handle (Poly_PolygonOnTriangulation)& thePolygon2, 118 const Handle (Poly_Triangulation)& theTriangulation, 119 const TopLoc_Location& theLocation); 120 121 //! Applies location to the given point and return result. 122 //! @param thePnt point to be transformed. 123 //! @param theLoc location to be applied. 124 Standard_EXPORT static gp_Pnt UseLocation ( 125 const gp_Pnt& thePnt, 126 const TopLoc_Location& theLoc); 127 128 //! Gets the strict UV locations of the extremities of the edge using pcurve. 129 Standard_EXPORT static Standard_Boolean UVPoints ( 130 const TopoDS_Edge& theEdge, 131 const TopoDS_Face& theFace, 132 gp_Pnt2d& theFirstPoint2d, 133 gp_Pnt2d& theLastPoint2d, 134 const Standard_Boolean isConsiderOrientation = Standard_False); 135 136 //! Gets the parametric range of the given edge on the given face. 137 Standard_EXPORT static Standard_Boolean Range ( 138 const TopoDS_Edge& theEdge, 139 const TopoDS_Face& theFace, 140 Handle (Geom2d_Curve)& thePCurve, 141 Standard_Real& theFirstParam, 142 Standard_Real& theLastParam, 143 const Standard_Boolean isConsiderOrientation = Standard_False); 144 145 //! Gets the 3d range of the given edge. 146 Standard_EXPORT static Standard_Boolean Range ( 147 const TopoDS_Edge& theEdge, 148 Handle (Geom_Curve)& theCurve, 149 Standard_Real& theFirstParam, 150 Standard_Real& theLastParam, 151 const Standard_Boolean isConsiderOrientation = Standard_False); 152 153 DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ShapeTool, Standard_Transient) 154 }; 155 156 #endif