8b7c5e47 |
1 | // Created on: 2013-06-06 |
2 | // Created by: Vlad ROMASHKO |
973c2be1 |
3 | // Copyright (c) 2013-2014 OPEN CASCADE SAS |
8b7c5e47 |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
8b7c5e47 |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
8b7c5e47 |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
8b7c5e47 |
15 | |
16 | #ifndef _CHFI2D_FILLETAPI_H_ |
17 | #define _CHFI2D_FILLETAPI_H_ |
18 | |
19 | #include <ChFi2d_FilletAlgo.hxx> |
20 | #include <ChFi2d_AnaFilletAlgo.hxx> |
21 | |
22 | //! An interface class for 2D fillets. |
23 | //! Open CASCADE provides two algorithms for 2D fillets: |
24 | //! ChFi2d_Builder - it constructs a fillet or chamfer |
25 | //! for linear and circular edges of a face. |
26 | //! ChFi2d_FilletAPI - it encapsulates two algorithms: |
27 | //! ChFi2d_AnaFilletAlgo - analytical constructor of the fillet. |
28 | //! It works only for linear and circular edges, |
29 | //! having a common point. |
30 | //! ChFi2d_FilletAlgo - iteration recursive method constructing |
31 | //! the fillet edge for any type of edges including |
32 | //! ellipses and b-splines. |
33 | //! The edges may even have no common point. |
34 | //! |
35 | //! The algorithms ChFi2d_AnaFilletAlgo and ChFi2d_FilletAlgo may be used directly |
36 | //! or via this ChFi2d_FilletAPI class. This class chooses an appropriate algorithm |
37 | //! analyzing the arguments (a wire or two edges). |
38 | class ChFi2d_FilletAPI |
39 | { |
40 | public: |
41 | |
42 | //! An empty constructor of the fillet algorithm. |
43 | //! Call a method Init() to initialize the algorithm |
44 | //! before calling of a Perform() method. |
45 | Standard_EXPORT ChFi2d_FilletAPI(); |
46 | |
47 | //! A constructor of a fillet algorithm: accepts a wire consisting of two edges in a plane. |
48 | Standard_EXPORT ChFi2d_FilletAPI(const TopoDS_Wire& theWire, |
49 | const gp_Pln& thePlane); |
50 | |
51 | //! A constructor of a fillet algorithm: accepts two edges in a plane. |
52 | Standard_EXPORT ChFi2d_FilletAPI(const TopoDS_Edge& theEdge1, |
53 | const TopoDS_Edge& theEdge2, |
54 | const gp_Pln& thePlane); |
55 | |
56 | //! Initializes a fillet algorithm: accepts a wire consisting of two edges in a plane. |
57 | Standard_EXPORT void Init(const TopoDS_Wire& theWire, |
58 | const gp_Pln& thePlane); |
59 | |
60 | //! Initializes a fillet algorithm: accepts two edges in a plane. |
61 | Standard_EXPORT void Init(const TopoDS_Edge& theEdge1, |
62 | const TopoDS_Edge& theEdge2, |
63 | const gp_Pln& thePlane); |
64 | |
65 | //! Constructs a fillet edge. |
66 | //! Returns true if at least one result was found. |
67 | Standard_EXPORT Standard_Boolean Perform(const Standard_Real theRadius); |
68 | |
69 | //! Returns number of possible solutions. |
70 | //! <thePoint> chooses a particular fillet in case of several fillets |
71 | //! may be constructed (for example, a circle intersecting a segment in 2 points). |
72 | //! Put the intersecting (or common) point of the edges. |
73 | Standard_EXPORT Standard_Integer NbResults(const gp_Pnt& thePoint); |
74 | |
75 | //! Returns result (fillet edge, modified edge1, modified edge2), |
76 | //! nearest to the given point <thePoint> if iSolution == -1 |
77 | //! <thePoint> chooses a particular fillet in case of several fillets |
78 | //! may be constructed (for example, a circle intersecting a segment in 2 points). |
79 | //! Put the intersecting (or common) point of the edges. |
80 | Standard_EXPORT TopoDS_Edge Result(const gp_Pnt& thePoint, |
81 | TopoDS_Edge& theEdge1, TopoDS_Edge& theEdge2, |
82 | const Standard_Integer iSolution = -1); |
83 | |
84 | private: |
85 | |
86 | // Decides whether the input parameters may use an analytical algorithm |
87 | // for calculation of the fillets, or an iteration-recursive method is needed. |
88 | // The analytical solution is applicable for linear and circular edges |
89 | // having a common point. |
90 | Standard_Boolean IsAnalytical(const TopoDS_Edge& theEdge1, |
91 | const TopoDS_Edge& theEdge2); |
92 | |
93 | // Implementation of the fillet algorithm. |
94 | ChFi2d_FilletAlgo myFilletAlgo; |
95 | ChFi2d_AnaFilletAlgo myAnaFilletAlgo; |
96 | Standard_Boolean myIsAnalytical; |
97 | }; |
98 | |
973c2be1 |
99 | #endif // _CHFI2D_FILLETAPI_H_ |