Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 2013-05-20
0002 // Created by: Vlad ROMASHKO
0003 // Copyright (c) 2003-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_AnaFilletAlgo_HeaderFile
0017 #define ChFi2d_AnaFilletAlgo_HeaderFile
0018 
0019 #include <TopoDS_Wire.hxx>
0020 #include <TopoDS_Edge.hxx>
0021 #include <gp_Pln.hxx>
0022 
0023 //! An analytical algorithm for calculation of the fillets.
0024 //! It is implemented for segments and arcs of circle only.
0025 class ChFi2d_AnaFilletAlgo
0026 {
0027 public:
0028 
0029   //! An empty constructor.
0030   //! Use the method Init() to initialize the class.
0031   Standard_EXPORT ChFi2d_AnaFilletAlgo();
0032 
0033   //! A constructor.
0034   //! It expects a wire consisting of two edges of type (any combination of):
0035   //! - segment
0036   //! - arc of circle.
0037   Standard_EXPORT ChFi2d_AnaFilletAlgo(const TopoDS_Wire& theWire, 
0038                                        const gp_Pln& thePlane);
0039 
0040   //! A constructor.
0041   //! It expects two edges having a common point of type:
0042   //! - segment
0043   //! - arc of circle.
0044   Standard_EXPORT ChFi2d_AnaFilletAlgo(const TopoDS_Edge& theEdge1, 
0045                                        const TopoDS_Edge& theEdge2,
0046                                        const gp_Pln& thePlane);
0047 
0048   //! Initializes the class by a wire consisting of two edges.
0049   Standard_EXPORT void Init(const TopoDS_Wire& theWire, const gp_Pln& thePlane);
0050 
0051   //! Initializes the class by two edges.
0052   Standard_EXPORT void Init(const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2, 
0053                             const gp_Pln& thePlane);
0054 
0055   //! Calculates a fillet.
0056   Standard_EXPORT Standard_Boolean Perform(const Standard_Real radius);
0057 
0058   //! Retrieves a result (fillet and shrinked neighbours).
0059   Standard_EXPORT const TopoDS_Edge& Result(TopoDS_Edge& e1, TopoDS_Edge& e2);
0060 
0061 private:
0062 
0063   // WW5 method to compute fillet.
0064   // It returns a constructed fillet definition:
0065   //     center point (xc, yc)
0066   //     point on the 1st segment (xstart, ystart)
0067   //     point on the 2nd segment (xend, yend)
0068   //     is the arc of fillet clockwise (cw = true) or counterclockwise (cw = false).
0069   Standard_Boolean SegmentFilletSegment(const Standard_Real radius, 
0070                                         Standard_Real& xc, Standard_Real& yc, 
0071                                         Standard_Boolean& cw,
0072                                         Standard_Real& start, Standard_Real& end);
0073 
0074   // A function constructs a fillet between a segment and an arc.
0075   Standard_Boolean SegmentFilletArc(const Standard_Real radius, 
0076                                     Standard_Real& xc, Standard_Real& yc, 
0077                                     Standard_Boolean& cw,
0078                                     Standard_Real& start, Standard_Real& end, 
0079                                     Standard_Real& xend, Standard_Real& yend);
0080 
0081   // A function constructs a fillet between an arc and a segment.
0082   Standard_Boolean ArcFilletSegment(const Standard_Real radius, 
0083                                     Standard_Real& xc, Standard_Real& yc, 
0084                                     Standard_Boolean& cw,
0085                                     Standard_Real& start, Standard_Real& end, 
0086                                     Standard_Real& xstart, Standard_Real& ystart);
0087 
0088   // WW5 method to compute fillet: arc - arc.
0089   // It returns a constructed fillet definition:
0090   //     center point (xc, yc)
0091   //     shrinking parameter of the 1st circle (start)
0092   //     shrinking parameter of the 2nd circle (end)
0093   //     if the arc of fillet clockwise (cw = true) or counterclockwise (cw = false).
0094   Standard_Boolean ArcFilletArc(const Standard_Real radius, 
0095                                 Standard_Real& xc, Standard_Real& yc, 
0096                                 Standard_Boolean& cw,
0097                                 Standard_Real& start, Standard_Real& end);
0098 
0099   // Cuts intersecting edges of a contour.
0100   Standard_Boolean Cut(const gp_Pln& plane, TopoDS_Edge& e1, TopoDS_Edge& e2);
0101 
0102   // Plane.
0103   gp_Pln           plane;
0104 
0105   // Left neighbour.
0106   TopoDS_Edge      e1;
0107   Standard_Boolean segment1;
0108   Standard_Real    x11;
0109   Standard_Real    y11;
0110   Standard_Real    x12;
0111   Standard_Real    y12;
0112   Standard_Real    xc1;
0113   Standard_Real    yc1;
0114   Standard_Real    radius1;
0115   Standard_Boolean cw1;
0116 
0117   // Right neighbour.
0118   TopoDS_Edge      e2;
0119   Standard_Boolean segment2;
0120   Standard_Real    x21;
0121   Standard_Real    y21;
0122   Standard_Real    x22;
0123   Standard_Real    y22;
0124   Standard_Real    xc2;
0125   Standard_Real    yc2;
0126   Standard_Real    radius2;
0127   Standard_Boolean cw2;
0128 
0129   // Fillet (result).
0130   TopoDS_Edge fillet;
0131   TopoDS_Edge shrinke1;
0132   TopoDS_Edge shrinke2;
0133 };
0134 
0135 #endif // _ANAFILLETALGO_H_