1 // Created on: 2013-05-20
2 // Created by: Vlad ROMASHKO
3 // Copyright (c) 2003-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _ANAFILLETALGO_H_
17 #define _ANAFILLETALGO_H_
19 #include <TopoDS_Wire.hxx>
20 #include <TopoDS_Edge.hxx>
23 //! An analytical algorithm for calculation of the fillets.
24 //! It is implemented for segments and arcs of circle only.
25 class ChFi2d_AnaFilletAlgo
29 //! An empty constructor.
30 //! Use the method Init() to initialize the class.
31 Standard_EXPORT ChFi2d_AnaFilletAlgo();
34 //! It expects a wire consisting of two edges of type (any combination of):
37 Standard_EXPORT ChFi2d_AnaFilletAlgo(const TopoDS_Wire& theWire,
38 const gp_Pln& thePlane);
41 //! It expects two edges having a common point of type:
44 Standard_EXPORT ChFi2d_AnaFilletAlgo(const TopoDS_Edge& theEdge1,
45 const TopoDS_Edge& theEdge2,
46 const gp_Pln& thePlane);
48 //! Initializes the class by a wire consisting of two edges.
49 Standard_EXPORT void Init(const TopoDS_Wire& theWire, const gp_Pln& thePlane);
51 //! Initializes the class by two edges.
52 Standard_EXPORT void Init(const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2,
53 const gp_Pln& thePlane);
55 //! Calculates a fillet.
56 Standard_EXPORT Standard_Boolean Perform(const Standard_Real radius);
58 //! Retrieves a result (fillet and shrinked neighbours).
59 Standard_EXPORT const TopoDS_Edge& Result(TopoDS_Edge& e1, TopoDS_Edge& e2);
63 // WW5 method to compute fillet.
64 // It returns a constructed fillet definition:
65 // center point (xc, yc)
66 // point on the 1st segment (xstart, ystart)
67 // point on the 2nd segment (xend, yend)
68 // is the arc of fillet clockwise (cw = true) or counterclockwise (cw = false).
69 Standard_Boolean SegmentFilletSegment(const Standard_Real radius,
70 Standard_Real& xc, Standard_Real& yc,
72 Standard_Real& start, Standard_Real& end);
74 // A function constructs a fillet between a segment and an arc.
75 Standard_Boolean SegmentFilletArc(const Standard_Real radius,
76 Standard_Real& xc, Standard_Real& yc,
78 Standard_Real& start, Standard_Real& end,
79 Standard_Real& xend, Standard_Real& yend);
81 // A function constructs a fillet between an arc and a segment.
82 Standard_Boolean ArcFilletSegment(const Standard_Real radius,
83 Standard_Real& xc, Standard_Real& yc,
85 Standard_Real& start, Standard_Real& end,
86 Standard_Real& xstart, Standard_Real& ystart);
88 // WW5 method to compute fillet: arc - arc.
89 // It returns a constructed fillet definition:
90 // center point (xc, yc)
91 // shrinking parameter of the 1st circle (start)
92 // shrinking parameter of the 2nd circle (end)
93 // if the arc of fillet clockwise (cw = true) or counterclockwise (cw = false).
94 Standard_Boolean ArcFilletArc(const Standard_Real radius,
95 Standard_Real& xc, Standard_Real& yc,
97 Standard_Real& start, Standard_Real& end);
99 // Cuts intersecting edges of a contour.
100 Standard_Boolean Cut(const gp_Pln& plane, TopoDS_Edge& e1, TopoDS_Edge& e2);
107 Standard_Boolean segment1;
114 Standard_Real radius1;
115 Standard_Boolean cw1;
119 Standard_Boolean segment2;
126 Standard_Real radius2;
127 Standard_Boolean cw2;
131 TopoDS_Edge shrinke1;
132 TopoDS_Edge shrinke2;
135 #endif // _ANAFILLETALGO_H_