// 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 "Standard.hxx" #include "Standard_DefineAlloc.hxx" #include "ChFi2d_ConstructionError.hxx" #include "TopoDS_Face.hxx" #include "TopoDS_Shape.hxx" #include "NCollection_Sequence.hxx" #include "TopTools_ShapeMapHasher.hxx" #include "NCollection_DataMap.hxx" #include "Standard_Integer.hxx" 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 double 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 double 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 double D1, const double 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 double D, const double 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 double D1, const double 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 double D, const double 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; bool IsModified(const TopoDS_Edge& E) const; //! returns the list of new edges const NCollection_Sequence& FilletEdges() const; int NbFillet() const; //! returns the list of new edges const NCollection_Sequence& ChamferEdges() const; int NbChamfer() const; bool 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; private: //! Is internally 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 double Radius, TopoDS_Edge& TrimE1, TopoDS_Edge& TrimE2, TopoDS_Edge& Fillet); //! Is internally 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 double D1, const double D2, TopoDS_Edge& TrimE1, TopoDS_Edge& TrimE2, TopoDS_Edge& Chamfer); //! Is internally 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 double D, const double Ang, const TopoDS_Edge& E2, TopoDS_Edge& TrimE1, TopoDS_Edge& TrimE2, TopoDS_Edge& Chamfer); //! Is internally 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 double Radius, TopoDS_Vertex& NewExtr1, TopoDS_Vertex& NewExtr2); //! Is internally 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 double D1, const double D2, TopoDS_Vertex& NewExtr1, TopoDS_Vertex& NewExtr2); //! Is internally 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 double D, const double 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 = true //! if the new edge is degenerated Standard_EXPORT TopoDS_Edge BuildNewEdge(const TopoDS_Edge& E1, const TopoDS_Vertex& OldExtr, const TopoDS_Vertex& NewExtr, bool& 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 int 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 bool IsAFillet(const TopoDS_Edge& E) const; Standard_EXPORT bool IsAChamfer(const TopoDS_Edge& E) const; ChFi2d_ConstructionError status; TopoDS_Face refFace; TopoDS_Face newFace; NCollection_Sequence fillets; NCollection_Sequence chamfers; NCollection_DataMap history; }; #include "ChFi2d_Builder.lxx" #endif // _ChFi2d_Builder_HeaderFile