1 // Created on: 2004-03-05 2 // Created by: Sergey KUUL 3 // Copyright (c) 2004-2014 OPEN CASCADE SAS 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 _ShapeFix_IntersectionTool_HeaderFile 17 #define _ShapeFix_IntersectionTool_HeaderFile 18 19 #include <Standard.hxx> 20 #include <Standard_DefineAlloc.hxx> 21 #include <Standard_Handle.hxx> 22 23 #include <Standard_Real.hxx> 24 #include <Standard_Boolean.hxx> 25 #include <Standard_Integer.hxx> 26 #include <ShapeFix_DataMapOfShapeBox2d.hxx> 27 class ShapeBuild_ReShape; 28 class TopoDS_Edge; 29 class TopoDS_Vertex; 30 class TopoDS_Face; 31 class ShapeExtend_WireData; 32 class Bnd_Box2d; 33 class Geom2d_Curve; 34 35 36 //! Tool for fixing selfintersecting wire 37 //! and intersecting wires 38 class ShapeFix_IntersectionTool 39 { 40 public: 41 42 DEFINE_STANDARD_ALLOC 43 44 45 //! Constructor 46 Standard_EXPORT ShapeFix_IntersectionTool(const Handle(ShapeBuild_ReShape)& context, const Standard_Real preci, const Standard_Real maxtol = 1.0); 47 48 //! Returns context 49 Handle(ShapeBuild_ReShape) Context() const; 50 51 //! Split edge on two new edges using new vertex "vert" 52 //! and "param" - parameter for splitting 53 //! The "face" is necessary for pcurves and using TransferParameterProj 54 Standard_EXPORT Standard_Boolean SplitEdge (const TopoDS_Edge& edge, const Standard_Real param, const TopoDS_Vertex& vert, const TopoDS_Face& face, TopoDS_Edge& newE1, TopoDS_Edge& newE2, const Standard_Real preci) const; 55 56 //! Cut edge by parameters pend and cut 57 Standard_EXPORT Standard_Boolean CutEdge (const TopoDS_Edge& edge, const Standard_Real pend, const Standard_Real cut, const TopoDS_Face& face, Standard_Boolean& iscutline) const; 58 59 Standard_EXPORT Standard_Boolean FixSelfIntersectWire (Handle(ShapeExtend_WireData)& sewd, const TopoDS_Face& face, Standard_Integer& NbSplit, Standard_Integer& NbCut, Standard_Integer& NbRemoved) const; 60 61 Standard_EXPORT Standard_Boolean FixIntersectingWires (TopoDS_Face& face) const; 62 63 64 65 66 protected: 67 68 69 70 71 72 private: 73 74 75 Standard_EXPORT Standard_Boolean SplitEdge1 (const Handle(ShapeExtend_WireData)& sewd, const TopoDS_Face& face, const Standard_Integer num, const Standard_Real param, const TopoDS_Vertex& vert, const Standard_Real preci, ShapeFix_DataMapOfShapeBox2d& boxes) const; 76 77 Standard_EXPORT Standard_Boolean SplitEdge2 (const Handle(ShapeExtend_WireData)& sewd, const TopoDS_Face& face, const Standard_Integer num, const Standard_Real param1, const Standard_Real param2, const TopoDS_Vertex& vert, const Standard_Real preci, ShapeFix_DataMapOfShapeBox2d& boxes) const; 78 79 Standard_EXPORT Standard_Boolean UnionVertexes (const Handle(ShapeExtend_WireData)& sewd, TopoDS_Edge& edge1, TopoDS_Edge& edge2, const Standard_Integer num2, ShapeFix_DataMapOfShapeBox2d& boxes, const Bnd_Box2d& B2) const; 80 81 Standard_EXPORT Standard_Boolean FindVertAndSplitEdge (const Standard_Real param1, const TopoDS_Edge& edge1, const TopoDS_Edge& edge2, const Handle(Geom2d_Curve)& Crv1, Standard_Real& MaxTolVert, Standard_Integer& num1, const Handle(ShapeExtend_WireData)& sewd, const TopoDS_Face& face, ShapeFix_DataMapOfShapeBox2d& boxes, const Standard_Boolean aTmpKey) const; 82 83 84 Handle(ShapeBuild_ReShape) myContext; 85 Standard_Real myPreci; 86 Standard_Real myMaxTol; 87 88 89 }; 90 91 92 #include <ShapeFix_IntersectionTool.lxx> 93 94 95 96 97 98 #endif // _ShapeFix_IntersectionTool_HeaderFile 99