Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:17:09

0001 // Created on: 2013-06-06
0002 // Created by: Vlad ROMASHKO
0003 // Copyright (c) 2013-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef ChFi2d_FilletAPI_HeaderFile
0017 #define ChFi2d_FilletAPI_HeaderFile
0018 
0019 #include <ChFi2d_FilletAlgo.hxx>
0020 #include <ChFi2d_AnaFilletAlgo.hxx>
0021 
0022 //! An interface class for 2D fillets.
0023 //! Open CASCADE provides two algorithms for 2D fillets:
0024 //!     ChFi2d_Builder - it constructs a fillet or chamfer
0025 //!                      for linear and circular edges of a face.
0026 //!     ChFi2d_FilletAPI - it encapsulates two algorithms:
0027 //!         ChFi2d_AnaFilletAlgo - analytical constructor of the fillet.
0028 //!                                It works only for linear and circular edges,
0029 //!                                having a common point.
0030 //!         ChFi2d_FilletAlgo - iteration recursive method constructing
0031 //!                             the fillet edge for any type of edges including
0032 //!                             ellipses and b-splines.
0033 //!                             The edges may even have no common point.
0034 //!
0035 //! The algorithms ChFi2d_AnaFilletAlgo and ChFi2d_FilletAlgo may be used directly
0036 //! or via this ChFi2d_FilletAPI class. This class chooses an appropriate algorithm
0037 //! analyzing the arguments (a wire or two edges).
0038 class ChFi2d_FilletAPI
0039 {
0040 public:
0041   //! An empty constructor of the fillet algorithm.
0042   //! Call a method Init() to initialize the algorithm
0043   //! before calling of a Perform() method.
0044   Standard_EXPORT ChFi2d_FilletAPI();
0045 
0046   //! A constructor of a fillet algorithm: accepts a wire consisting of two edges in a plane.
0047   Standard_EXPORT ChFi2d_FilletAPI(const TopoDS_Wire& theWire, const gp_Pln& thePlane);
0048 
0049   //! A constructor of a fillet algorithm: accepts two edges in a plane.
0050   Standard_EXPORT ChFi2d_FilletAPI(const TopoDS_Edge& theEdge1,
0051                                    const TopoDS_Edge& theEdge2,
0052                                    const gp_Pln&      thePlane);
0053 
0054   //! Initializes a fillet algorithm: accepts a wire consisting of two edges in a plane.
0055   Standard_EXPORT void Init(const TopoDS_Wire& theWire, const gp_Pln& thePlane);
0056 
0057   //! Initializes a fillet algorithm: accepts two edges in a plane.
0058   Standard_EXPORT void Init(const TopoDS_Edge& theEdge1,
0059                             const TopoDS_Edge& theEdge2,
0060                             const gp_Pln&      thePlane);
0061 
0062   //! Constructs a fillet edge.
0063   //! Returns true if at least one result was found.
0064   Standard_EXPORT bool Perform(const double theRadius);
0065 
0066   //! Returns number of possible solutions.
0067   //! <thePoint> chooses a particular fillet in case of several fillets
0068   //! may be constructed (for example, a circle intersecting a segment in 2 points).
0069   //! Put the intersecting (or common) point of the edges.
0070   Standard_EXPORT int NbResults(const gp_Pnt& thePoint);
0071 
0072   //! Returns result (fillet edge, modified edge1, modified edge2),
0073   //! nearest to the given point <thePoint> if iSolution == -1
0074   //! <thePoint> chooses a particular fillet in case of several fillets
0075   //! may be constructed (for example, a circle intersecting a segment in 2 points).
0076   //! Put the intersecting (or common) point of the edges.
0077   Standard_EXPORT TopoDS_Edge Result(const gp_Pnt& thePoint,
0078                                      TopoDS_Edge&  theEdge1,
0079                                      TopoDS_Edge&  theEdge2,
0080                                      const int     iSolution = -1);
0081 
0082 private:
0083   // Decides whether the input parameters may use an analytical algorithm
0084   // for calculation of the fillets, or an iteration-recursive method is needed.
0085   // The analytical solution is applicable for linear and circular edges
0086   // having a common point.
0087   bool IsAnalytical(const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2);
0088 
0089   // Implementation of the fillet algorithm.
0090   ChFi2d_FilletAlgo    myFilletAlgo;
0091   ChFi2d_AnaFilletAlgo myAnaFilletAlgo;
0092   bool                 myIsAnalytical;
0093 };
0094 
0095 #endif // _CHFI2D_FILLETAPI_H_