// Created on: 1995-06-12 // Created by: Joelle CHAUVET // Copyright (c) 1995-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #ifndef _ChFi2d_Builder_HeaderFile #define _ChFi2d_Builder_HeaderFile #include #include #include #include #include #include #include #include #include #include class TopoDS_Edge; class TopoDS_Vertex; // resolve name collisions with X11 headers #ifdef Status #undef Status #endif //! This class contains the algorithm used to build //! fillet on planar wire. class ChFi2d_Builder { public: DEFINE_STANDARD_ALLOC Standard_EXPORT ChFi2d_Builder(); //! The face can be build on a closed or an open //! wire. Standard_EXPORT ChFi2d_Builder(const TopoDS_Face& F); Standard_EXPORT void Init (const TopoDS_Face& F); Standard_EXPORT void Init (const TopoDS_Face& RefFace, const TopoDS_Face& ModFace); //! Add a fillet of radius on the wire //! between the two edges connected to the vertex . //! returns the fillet edge. The returned //! edge has sense only if the status is //! Standard_EXPORT TopoDS_Edge AddFillet (const TopoDS_Vertex& V, const Standard_Real Radius); //! modify the fillet radius and return the new fillet //! edge. this edge has sense only if the status //! is . Standard_EXPORT TopoDS_Edge ModifyFillet (const TopoDS_Edge& Fillet, const Standard_Real Radius); //! removes the fillet and returns the vertex //! connecting the two adjacent edges to this fillet. Standard_EXPORT TopoDS_Vertex RemoveFillet (const TopoDS_Edge& Fillet); //! Add a chamfer on the wire between the two edges //! connected and . returns the //! chamfer edge. This edge has sense only if the //! status is . Standard_EXPORT TopoDS_Edge AddChamfer (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2); //! Add a chamfer on the wire between the two edges //! connected to the vertex . The chamfer will make //! an angle with the edge , and one of its //! extremities will be on at distance . The //! returned edge has sense only if the status //! is . //! Warning: The value of must be expressed in Radian. Standard_EXPORT TopoDS_Edge AddChamfer (const TopoDS_Edge& E, const TopoDS_Vertex& V, const Standard_Real D, const Standard_Real Ang); //! modify the chamfer and returns the new //! chamfer edge. //! This edge as sense only if the status is //! . Standard_EXPORT TopoDS_Edge ModifyChamfer (const TopoDS_Edge& Chamfer, const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2); //! modify the chamfer and returns the new //! chamfer edge. This edge as sense only if the //! status is . //! Warning: The value of must be expressed in Radian. Standard_EXPORT TopoDS_Edge ModifyChamfer (const TopoDS_Edge& Chamfer, const TopoDS_Edge& E, const Standard_Real D, const Standard_Real Ang); //! removes the chamfer and returns the //! vertex connecting the two adjacent edges to this //! chamfer. Standard_EXPORT TopoDS_Vertex RemoveChamfer (const TopoDS_Edge& Chamfer); //! returns the modified face TopoDS_Face Result() const; Standard_Boolean IsModified (const TopoDS_Edge& E) const; //! returns the list of new edges const TopTools_SequenceOfShape& FilletEdges() const; Standard_Integer NbFillet() const; //! returns the list of new edges const TopTools_SequenceOfShape& ChamferEdges() const; Standard_Integer NbChamfer() const; Standard_Boolean HasDescendant (const TopoDS_Edge& E) const; //! returns the modified edge if has descendant or //! in the other case. const TopoDS_Edge& DescendantEdge (const TopoDS_Edge& E) const; //! Returns the parent edge of //! Warning: If is a basis edge, the returned edge would be //! equal to Standard_EXPORT const TopoDS_Edge& BasisEdge (const TopoDS_Edge& E) const; ChFi2d_ConstructionError Status() const; protected: private: //! Is internaly used by . //! Warning: , , has sense only if the //! status is equal to Standard_EXPORT void ComputeFillet (const TopoDS_Vertex& V, const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real Radius, TopoDS_Edge& TrimE1, TopoDS_Edge& TrimE2, TopoDS_Edge& Fillet); //! Is internaly used by . The chamfer is //! computed from a vertex, two edges and two //! distances //! Warning: , and has sense only if //! if the status is equal to Standard_EXPORT void ComputeChamfer (const TopoDS_Vertex& V, const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2, TopoDS_Edge& TrimE1, TopoDS_Edge& TrimE2, TopoDS_Edge& Chamfer); //! Is internaly used by . The chamfer is //! computed from an edge, a vertex, a distance //! and an angle //! Warning: , , and has //! sense only if the status is equal to //! Standard_EXPORT void ComputeChamfer (const TopoDS_Vertex& V, const TopoDS_Edge& E1, const Standard_Real D, const Standard_Real Ang, const TopoDS_Edge& E2, TopoDS_Edge& TrimE1, TopoDS_Edge& TrimE2, TopoDS_Edge& Chamfer); //! Is internaly used by . //! and will contains the new //! extremities of and //! Warning: The returned edge has sense only if the status //! is equal to //! or to one of those specific cases : //! //! //! Standard_EXPORT TopoDS_Edge BuildFilletEdge (const TopoDS_Vertex& V, const TopoDS_Edge& AdjEdge1, const TopoDS_Edge& AdjEdge2, const Standard_Real Radius, TopoDS_Vertex& NewExtr1, TopoDS_Vertex& NewExtr2); //! Is internaly used by . //! and will contains the new //! extremities of and //! Warning: The returned edge has sense only if the status //! is equal to Standard_EXPORT TopoDS_Edge BuildChamferEdge (const TopoDS_Vertex& V, const TopoDS_Edge& AdjEdge1, const TopoDS_Edge& AdjEdge2, const Standard_Real D1, const Standard_Real D2, TopoDS_Vertex& NewExtr1, TopoDS_Vertex& NewExtr2); //! Is internaly used by . //! and will contains the new //! extremities of and //! Warning: The returned edge has sense only if the status //! is equal to Standard_EXPORT TopoDS_Edge BuildChamferEdge (const TopoDS_Vertex& V, const TopoDS_Edge& AdjEdge2, const Standard_Real D, const Standard_Real Ang, const TopoDS_Edge& AdjEdge1, TopoDS_Vertex& NewExtr1, TopoDS_Vertex& NewExtr2); //! replaces in the new face and //! by , and //! or by and if is degenerated //! or by and if is degenerated //! or by if and are degenerated . Standard_EXPORT void BuildNewWire (const TopoDS_Edge& OldE1, const TopoDS_Edge& OldE2, const TopoDS_Edge& E1, const TopoDS_Edge& Fillet, const TopoDS_Edge& E2); //! Changes of by Standard_EXPORT TopoDS_Edge BuildNewEdge (const TopoDS_Edge& E1, const TopoDS_Vertex& OldExtr, const TopoDS_Vertex& NewExtr) const; //! Changes of by //! returns E1 and IsDegenerated = Standard_True //! if the new edge is degenerated Standard_EXPORT TopoDS_Edge BuildNewEdge (const TopoDS_Edge& E1, const TopoDS_Vertex& OldExtr, const TopoDS_Vertex& NewExtr, Standard_Boolean& IsDegenerated) const; //! Writes in if is equal to //! 1, or in if is Equal to 2. //! Writes the modifications in : //! is given by , by //! if and are not degenerated. Standard_EXPORT void UpDateHistory (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const TopoDS_Edge& TrimE1, const TopoDS_Edge& TrimE2, const TopoDS_Edge& NewEdge, const Standard_Integer Id); //! Writes the modifications in . //! is given by , by . Standard_EXPORT void UpDateHistory (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const TopoDS_Edge& TrimE1, const TopoDS_Edge& TrimE2); Standard_EXPORT Standard_Boolean IsAFillet (const TopoDS_Edge& E) const; Standard_EXPORT Standard_Boolean IsAChamfer (const TopoDS_Edge& E) const; ChFi2d_ConstructionError status; TopoDS_Face refFace; TopoDS_Face newFace; TopTools_SequenceOfShape fillets; TopTools_SequenceOfShape chamfers; TopTools_DataMapOfShapeShape history; }; #include #endif // _ChFi2d_Builder_HeaderFile