Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:20

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 
0042   //! An empty constructor of the fillet algorithm.
0043   //! Call a method Init() to initialize the algorithm
0044   //! before calling of a Perform() method.
0045   Standard_EXPORT ChFi2d_FilletAPI();
0046 
0047   //! A constructor of a fillet algorithm: accepts a wire consisting of two edges in a plane.
0048   Standard_EXPORT ChFi2d_FilletAPI(const TopoDS_Wire& theWire, 
0049                                    const gp_Pln& thePlane);
0050 
0051   //! A constructor of a fillet algorithm: accepts two edges in a plane.
0052   Standard_EXPORT ChFi2d_FilletAPI(const TopoDS_Edge& theEdge1, 
0053                                    const TopoDS_Edge& theEdge2, 
0054                                    const gp_Pln& thePlane);
0055 
0056   //! Initializes a fillet algorithm: accepts a wire consisting of two edges in a plane.
0057   Standard_EXPORT void Init(const TopoDS_Wire& theWire, 
0058                             const gp_Pln& thePlane);
0059 
0060   //! Initializes a fillet algorithm: accepts two edges in a plane.
0061   Standard_EXPORT void Init(const TopoDS_Edge& theEdge1, 
0062                             const TopoDS_Edge& theEdge2, 
0063                             const gp_Pln& thePlane);
0064 
0065   //! Constructs a fillet edge.
0066   //! Returns true if at least one result was found.
0067   Standard_EXPORT Standard_Boolean Perform(const Standard_Real theRadius);
0068 
0069   //! Returns number of possible solutions.
0070   //! <thePoint> chooses a particular fillet in case of several fillets 
0071   //! may be constructed (for example, a circle intersecting a segment in 2 points).
0072   //! Put the intersecting (or common) point of the edges.
0073   Standard_EXPORT Standard_Integer NbResults(const gp_Pnt& thePoint);
0074 
0075   //! Returns result (fillet edge, modified edge1, modified edge2), 
0076   //! nearest to the given point <thePoint> if iSolution == -1
0077   //! <thePoint> chooses a particular fillet in case of several fillets 
0078   //! may be constructed (for example, a circle intersecting a segment in 2 points).
0079   //! Put the intersecting (or common) point of the edges.
0080   Standard_EXPORT TopoDS_Edge Result(const gp_Pnt& thePoint, 
0081                                      TopoDS_Edge& theEdge1, TopoDS_Edge& theEdge2, 
0082                                      const Standard_Integer iSolution = -1);
0083 
0084 private:
0085 
0086   // Decides whether the input parameters may use an analytical algorithm
0087   // for calculation of the fillets, or an iteration-recursive method is needed.
0088   // The analytical solution is applicable for linear and circular edges 
0089   // having a common point.
0090   Standard_Boolean IsAnalytical(const TopoDS_Edge& theEdge1, 
0091                                 const TopoDS_Edge& theEdge2);
0092 
0093   // Implementation of the fillet algorithm.
0094   ChFi2d_FilletAlgo    myFilletAlgo;
0095   ChFi2d_AnaFilletAlgo myAnaFilletAlgo;
0096   Standard_Boolean     myIsAnalytical;
0097 };
0098 
0099 #endif // _CHFI2D_FILLETAPI_H_