Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-05 08:44:17

0001 // Created on: 1995-04-26
0002 // Created by: Modelistation
0003 // Copyright (c) 1995-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _ChFi3d_ChBuilder_HeaderFile
0018 #define _ChFi3d_ChBuilder_HeaderFile
0019 
0020 #include <BRepAdaptor_Surface.hxx>
0021 #include <ChFi3d_Builder.hxx>
0022 #include <ChFiDS_ChamfMethod.hxx>
0023 #include <ChFiDS_ChamfMode.hxx>
0024 #include <ChFiDS_SecHArray1.hxx>
0025 #include <ChFiDS_ListOfStripe.hxx>
0026 #include <ChFiDS_SequenceOfSurfData.hxx>
0027 #include <ChFiDS_ElSpine.hxx>
0028 #include <math_Vector.hxx>
0029 #include <TopAbs_Orientation.hxx>
0030 #include <TopAbs_State.hxx>
0031 
0032 class TopoDS_Shape;
0033 class TopoDS_Edge;
0034 class TopoDS_Face;
0035 class ChFiDS_SurfData;
0036 class ChFiDS_Spine;
0037 class Adaptor3d_TopolTool;
0038 class TopoDS_Vertex;
0039 class ChFiDS_Stripe;
0040 
0041 //! construction tool for 3D chamfers on edges (on a solid).
0042 class ChFi3d_ChBuilder : public ChFi3d_Builder
0043 {
0044 public:
0045   DEFINE_STANDARD_ALLOC
0046 
0047   //! initializes the Builder with the Shape <S> for the
0048   //! computation of chamfers
0049   Standard_EXPORT ChFi3d_ChBuilder(const TopoDS_Shape& S, const Standard_Real Ta = 1.0e-2);
0050 
0051   //! initializes a contour with the edge <E> as first
0052   //! (the next are found by propagation ).
0053   //! The two distances (parameters of the chamfer) must
0054   //! be set after.
0055   //! if the edge <E> has more than 2 adjacent faces
0056   Standard_EXPORT void Add(const TopoDS_Edge& E);
0057 
0058   //! initializes a new contour with the edge <E> as first
0059   //! (the next are found by propagation ), and  the
0060   //! distance <Dis>
0061   //! if the edge <E> has more than 2 adjacent faces
0062   Standard_EXPORT void Add(const Standard_Real Dis, const TopoDS_Edge& E);
0063 
0064   //! set the distance <Dis> of the fillet
0065   //! contour of index <IC> in the DS with <Dis> on <F>.
0066   //! if the face <F> is not one of common faces
0067   //! of an edge of the contour <IC>
0068   Standard_EXPORT void SetDist(const Standard_Real    Dis,
0069                                const Standard_Integer IC,
0070                                const TopoDS_Face&     F);
0071 
0072   //! gives the distances <Dis> of the fillet
0073   //! contour of index <IC> in the DS
0074   Standard_EXPORT void GetDist(const Standard_Integer IC, Standard_Real& Dis) const;
0075 
0076   //! initializes a new contour with the edge <E> as first
0077   //! (the next are found by propagation ), and  the
0078   //! distance <Dis1> and <Dis2>
0079   //! if the edge <E> has more than 2 adjacent faces
0080   Standard_EXPORT void Add(const Standard_Real Dis1,
0081                            const Standard_Real Dis2,
0082                            const TopoDS_Edge&  E,
0083                            const TopoDS_Face&  F);
0084 
0085   //! set the distances <Dis1> and <Dis2> of the fillet
0086   //! contour of index <IC> in the DS with <Dis1> on <F>.
0087   //! if the face <F> is not one of common faces
0088   //! of an edge of the contour <IC>
0089   Standard_EXPORT void SetDists(const Standard_Real    Dis1,
0090                                 const Standard_Real    Dis2,
0091                                 const Standard_Integer IC,
0092                                 const TopoDS_Face&     F);
0093 
0094   //! gives the distances <Dis1> and <Dis2> of the fillet
0095   //! contour of index <IC> in the DS
0096   Standard_EXPORT void Dists(const Standard_Integer IC,
0097                              Standard_Real&         Dis1,
0098                              Standard_Real&         Dis2) const;
0099 
0100   //! initializes a new contour with the edge <E> as first
0101   //! (the next are found by propagation ), and  the
0102   //! distance <Dis1> and <Angle>
0103   //! if the edge <E> has more than 2 adjacent faces
0104   Standard_EXPORT void AddDA(const Standard_Real Dis,
0105                              const Standard_Real Angle,
0106                              const TopoDS_Edge&  E,
0107                              const TopoDS_Face&  F);
0108 
0109   //! set the distance <Dis> and <Angle> of the fillet
0110   //! contour of index <IC> in the DS with <Dis> on <F>.
0111   //! if the face <F> is not one of common faces
0112   //! of an edge of the contour <IC>
0113   Standard_EXPORT void SetDistAngle(const Standard_Real    Dis,
0114                                     const Standard_Real    Angle,
0115                                     const Standard_Integer IC,
0116                                     const TopoDS_Face&     F);
0117 
0118   //! gives the distances <Dis> and <Angle> of the fillet
0119   //! contour of index <IC> in the DS
0120   Standard_EXPORT void GetDistAngle(const Standard_Integer IC,
0121                                     Standard_Real&         Dis,
0122                                     Standard_Real&         Angle) const;
0123 
0124   //! set the mode of shamfer
0125   Standard_EXPORT void SetMode(const ChFiDS_ChamfMode theMode);
0126 
0127   //! renvoi la methode des chanfreins utilisee
0128   Standard_EXPORT ChFiDS_ChamfMethod IsChamfer(const Standard_Integer IC) const;
0129 
0130   //! returns the mode of chamfer used
0131   Standard_EXPORT ChFiDS_ChamfMode Mode() const;
0132 
0133   //! Reset tous rayons du contour IC.
0134   Standard_EXPORT void ResetContour(const Standard_Integer IC);
0135 
0136   Standard_EXPORT void Simulate(const Standard_Integer IC);
0137 
0138   Standard_EXPORT Standard_Integer NbSurf(const Standard_Integer IC) const;
0139 
0140   Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect(const Standard_Integer IC,
0141                                                  const Standard_Integer IS) const;
0142 
0143   Standard_EXPORT virtual void SimulSurf(Handle(ChFiDS_SurfData)&           Data,
0144                                          const Handle(ChFiDS_ElSpine)&      Guide,
0145                                          const Handle(ChFiDS_Spine)&        Spine,
0146                                          const Standard_Integer             Choix,
0147                                          const Handle(BRepAdaptor_Surface)& S1,
0148                                          const Handle(Adaptor3d_TopolTool)& I1,
0149                                          const Handle(BRepAdaptor_Curve2d)& PC1,
0150                                          const Handle(BRepAdaptor_Surface)& Sref1,
0151                                          const Handle(BRepAdaptor_Curve2d)& PCref1,
0152                                          Standard_Boolean&                  Decroch1,
0153                                          const Handle(BRepAdaptor_Surface)& S2,
0154                                          const Handle(Adaptor3d_TopolTool)& I2,
0155                                          const TopAbs_Orientation           Or2,
0156                                          const Standard_Real                Fleche,
0157                                          const Standard_Real                TolGuide,
0158                                          Standard_Real&                     First,
0159                                          Standard_Real&                     Last,
0160                                          const Standard_Boolean             Inside,
0161                                          const Standard_Boolean             Appro,
0162                                          const Standard_Boolean             Forward,
0163                                          const Standard_Boolean             RecP,
0164                                          const Standard_Boolean             RecS,
0165                                          const Standard_Boolean             RecRst,
0166                                          const math_Vector& Soldep) Standard_OVERRIDE;
0167 
0168   Standard_EXPORT virtual void SimulSurf(Handle(ChFiDS_SurfData)&           Data,
0169                                          const Handle(ChFiDS_ElSpine)&      Guide,
0170                                          const Handle(ChFiDS_Spine)&        Spine,
0171                                          const Standard_Integer             Choix,
0172                                          const Handle(BRepAdaptor_Surface)& S1,
0173                                          const Handle(Adaptor3d_TopolTool)& I1,
0174                                          const TopAbs_Orientation           Or1,
0175                                          const Handle(BRepAdaptor_Surface)& S2,
0176                                          const Handle(Adaptor3d_TopolTool)& I2,
0177                                          const Handle(BRepAdaptor_Curve2d)& PC2,
0178                                          const Handle(BRepAdaptor_Surface)& Sref2,
0179                                          const Handle(BRepAdaptor_Curve2d)& PCref2,
0180                                          Standard_Boolean&                  Decroch2,
0181                                          const Standard_Real                Fleche,
0182                                          const Standard_Real                TolGuide,
0183                                          Standard_Real&                     First,
0184                                          Standard_Real&                     Last,
0185                                          const Standard_Boolean             Inside,
0186                                          const Standard_Boolean             Appro,
0187                                          const Standard_Boolean             Forward,
0188                                          const Standard_Boolean             RecP,
0189                                          const Standard_Boolean             RecS,
0190                                          const Standard_Boolean             RecRst,
0191                                          const math_Vector& Soldep) Standard_OVERRIDE;
0192 
0193   Standard_EXPORT virtual void SimulSurf(Handle(ChFiDS_SurfData)&           Data,
0194                                          const Handle(ChFiDS_ElSpine)&      Guide,
0195                                          const Handle(ChFiDS_Spine)&        Spine,
0196                                          const Standard_Integer             Choix,
0197                                          const Handle(BRepAdaptor_Surface)& S1,
0198                                          const Handle(Adaptor3d_TopolTool)& I1,
0199                                          const Handle(BRepAdaptor_Curve2d)& PC1,
0200                                          const Handle(BRepAdaptor_Surface)& Sref1,
0201                                          const Handle(BRepAdaptor_Curve2d)& PCref1,
0202                                          Standard_Boolean&                  Decroch1,
0203                                          const TopAbs_Orientation           Or1,
0204                                          const Handle(BRepAdaptor_Surface)& S2,
0205                                          const Handle(Adaptor3d_TopolTool)& I2,
0206                                          const Handle(BRepAdaptor_Curve2d)& PC2,
0207                                          const Handle(BRepAdaptor_Surface)& Sref2,
0208                                          const Handle(BRepAdaptor_Curve2d)& PCref2,
0209                                          Standard_Boolean&                  Decroch2,
0210                                          const TopAbs_Orientation           Or2,
0211                                          const Standard_Real                Fleche,
0212                                          const Standard_Real                TolGuide,
0213                                          Standard_Real&                     First,
0214                                          Standard_Real&                     Last,
0215                                          const Standard_Boolean             Inside,
0216                                          const Standard_Boolean             Appro,
0217                                          const Standard_Boolean             Forward,
0218                                          const Standard_Boolean             RecP1,
0219                                          const Standard_Boolean             RecRst1,
0220                                          const Standard_Boolean             RecP2,
0221                                          const Standard_Boolean             RecRst2,
0222                                          const math_Vector& Soldep) Standard_OVERRIDE;
0223 
0224   //! Methode, implemented in inheritants, calculates
0225   //! the elements of construction of  the surface (fillet
0226   //! or chamfer).
0227   Standard_EXPORT virtual Standard_Boolean PerformSurf(ChFiDS_SequenceOfSurfData&         Data,
0228                                                        const Handle(ChFiDS_ElSpine)&      Guide,
0229                                                        const Handle(ChFiDS_Spine)&        Spine,
0230                                                        const Standard_Integer             Choix,
0231                                                        const Handle(BRepAdaptor_Surface)& S1,
0232                                                        const Handle(Adaptor3d_TopolTool)& I1,
0233                                                        const Handle(BRepAdaptor_Surface)& S2,
0234                                                        const Handle(Adaptor3d_TopolTool)& I2,
0235                                                        const Standard_Real                MaxStep,
0236                                                        const Standard_Real                Fleche,
0237                                                        const Standard_Real                TolGuide,
0238                                                        Standard_Real&                     First,
0239                                                        Standard_Real&                     Last,
0240                                                        const Standard_Boolean             Inside,
0241                                                        const Standard_Boolean             Appro,
0242                                                        const Standard_Boolean             Forward,
0243                                                        const Standard_Boolean             RecOnS1,
0244                                                        const Standard_Boolean             RecOnS2,
0245                                                        const math_Vector&                 Soldep,
0246                                                        Standard_Integer&                  Intf,
0247                                                        Standard_Integer& Intl) Standard_OVERRIDE;
0248 
0249   //! Method, implemented in  the inheritants, calculates
0250   //! the elements of construction of  the surface (fillet
0251   //! or chamfer) contact edge/face.
0252   Standard_EXPORT virtual void PerformSurf(ChFiDS_SequenceOfSurfData&         Data,
0253                                            const Handle(ChFiDS_ElSpine)&      Guide,
0254                                            const Handle(ChFiDS_Spine)&        Spine,
0255                                            const Standard_Integer             Choix,
0256                                            const Handle(BRepAdaptor_Surface)& S1,
0257                                            const Handle(Adaptor3d_TopolTool)& I1,
0258                                            const Handle(BRepAdaptor_Curve2d)& PC1,
0259                                            const Handle(BRepAdaptor_Surface)& Sref1,
0260                                            const Handle(BRepAdaptor_Curve2d)& PCref1,
0261                                            Standard_Boolean&                  Decroch1,
0262                                            const Handle(BRepAdaptor_Surface)& S2,
0263                                            const Handle(Adaptor3d_TopolTool)& I2,
0264                                            const TopAbs_Orientation           Or2,
0265                                            const Standard_Real                MaxStep,
0266                                            const Standard_Real                Fleche,
0267                                            const Standard_Real                TolGuide,
0268                                            Standard_Real&                     First,
0269                                            Standard_Real&                     Last,
0270                                            const Standard_Boolean             Inside,
0271                                            const Standard_Boolean             Appro,
0272                                            const Standard_Boolean             Forward,
0273                                            const Standard_Boolean             RecP,
0274                                            const Standard_Boolean             RecS,
0275                                            const Standard_Boolean             RecRst,
0276                                            const math_Vector& Soldep) Standard_OVERRIDE;
0277 
0278   //! Method, implemented in inheritants, calculates
0279   //! the elements of construction of  the surface (fillet
0280   //! or chamfer) contact edge/face.
0281   Standard_EXPORT virtual void PerformSurf(ChFiDS_SequenceOfSurfData&         Data,
0282                                            const Handle(ChFiDS_ElSpine)&      Guide,
0283                                            const Handle(ChFiDS_Spine)&        Spine,
0284                                            const Standard_Integer             Choix,
0285                                            const Handle(BRepAdaptor_Surface)& S1,
0286                                            const Handle(Adaptor3d_TopolTool)& I1,
0287                                            const TopAbs_Orientation           Or1,
0288                                            const Handle(BRepAdaptor_Surface)& S2,
0289                                            const Handle(Adaptor3d_TopolTool)& I2,
0290                                            const Handle(BRepAdaptor_Curve2d)& PC2,
0291                                            const Handle(BRepAdaptor_Surface)& Sref2,
0292                                            const Handle(BRepAdaptor_Curve2d)& PCref2,
0293                                            Standard_Boolean&                  Decroch2,
0294                                            const Standard_Real                MaxStep,
0295                                            const Standard_Real                Fleche,
0296                                            const Standard_Real                TolGuide,
0297                                            Standard_Real&                     First,
0298                                            Standard_Real&                     Last,
0299                                            const Standard_Boolean             Inside,
0300                                            const Standard_Boolean             Appro,
0301                                            const Standard_Boolean             Forward,
0302                                            const Standard_Boolean             RecP,
0303                                            const Standard_Boolean             RecS,
0304                                            const Standard_Boolean             RecRst,
0305                                            const math_Vector& Soldep) Standard_OVERRIDE;
0306 
0307   //! Method, implemented in  inheritants, calculates
0308   //! the elements of construction of  the surface (fillet
0309   //! or chamfer) contact edge/edge.
0310   Standard_EXPORT virtual void PerformSurf(ChFiDS_SequenceOfSurfData&         Data,
0311                                            const Handle(ChFiDS_ElSpine)&      Guide,
0312                                            const Handle(ChFiDS_Spine)&        Spine,
0313                                            const Standard_Integer             Choix,
0314                                            const Handle(BRepAdaptor_Surface)& S1,
0315                                            const Handle(Adaptor3d_TopolTool)& I1,
0316                                            const Handle(BRepAdaptor_Curve2d)& PC1,
0317                                            const Handle(BRepAdaptor_Surface)& Sref1,
0318                                            const Handle(BRepAdaptor_Curve2d)& PCref1,
0319                                            Standard_Boolean&                  Decroch1,
0320                                            const TopAbs_Orientation           Or1,
0321                                            const Handle(BRepAdaptor_Surface)& S2,
0322                                            const Handle(Adaptor3d_TopolTool)& I2,
0323                                            const Handle(BRepAdaptor_Curve2d)& PC2,
0324                                            const Handle(BRepAdaptor_Surface)& Sref2,
0325                                            const Handle(BRepAdaptor_Curve2d)& PCref2,
0326                                            Standard_Boolean&                  Decroch2,
0327                                            const TopAbs_Orientation           Or2,
0328                                            const Standard_Real                MaxStep,
0329                                            const Standard_Real                Fleche,
0330                                            const Standard_Real                TolGuide,
0331                                            Standard_Real&                     First,
0332                                            Standard_Real&                     Last,
0333                                            const Standard_Boolean             Inside,
0334                                            const Standard_Boolean             Appro,
0335                                            const Standard_Boolean             Forward,
0336                                            const Standard_Boolean             RecP1,
0337                                            const Standard_Boolean             RecRst1,
0338                                            const Standard_Boolean             RecP2,
0339                                            const Standard_Boolean             RecRst2,
0340                                            const math_Vector& Soldep) Standard_OVERRIDE;
0341 
0342 protected:
0343   Standard_EXPORT void SimulKPart(const Handle(ChFiDS_SurfData)& SD) const Standard_OVERRIDE;
0344 
0345   Standard_EXPORT Standard_Boolean SimulSurf(Handle(ChFiDS_SurfData)&           Data,
0346                                              const Handle(ChFiDS_ElSpine)&      Guide,
0347                                              const Handle(ChFiDS_Spine)&        Spine,
0348                                              const Standard_Integer             Choix,
0349                                              const Handle(BRepAdaptor_Surface)& S1,
0350                                              const Handle(Adaptor3d_TopolTool)& I1,
0351                                              const Handle(BRepAdaptor_Surface)& S2,
0352                                              const Handle(Adaptor3d_TopolTool)& I2,
0353                                              const Standard_Real                TolGuide,
0354                                              Standard_Real&                     First,
0355                                              Standard_Real&                     Last,
0356                                              const Standard_Boolean             Inside,
0357                                              const Standard_Boolean             Appro,
0358                                              const Standard_Boolean             Forward,
0359                                              const Standard_Boolean             RecOnS1,
0360                                              const Standard_Boolean             RecOnS2,
0361                                              const math_Vector&                 Soldep,
0362                                              Standard_Integer&                  Intf,
0363                                              Standard_Integer& Intl) Standard_OVERRIDE;
0364 
0365   Standard_EXPORT Standard_Boolean PerformFirstSection(const Handle(ChFiDS_Spine)&        S,
0366                                                        const Handle(ChFiDS_ElSpine)&      HGuide,
0367                                                        const Standard_Integer             Choix,
0368                                                        Handle(BRepAdaptor_Surface)&       S1,
0369                                                        Handle(BRepAdaptor_Surface)&       S2,
0370                                                        const Handle(Adaptor3d_TopolTool)& I1,
0371                                                        const Handle(Adaptor3d_TopolTool)& I2,
0372                                                        const Standard_Real                Par,
0373                                                        math_Vector&                       SolDep,
0374                                                        TopAbs_State&                      Pos1,
0375                                                        TopAbs_State& Pos2) const Standard_OVERRIDE;
0376 
0377   //! computes  the  intersection of two chamfers on
0378   //! the vertex of index <Index> in myVDataMap.
0379   Standard_EXPORT void PerformTwoCorner(const Standard_Integer Index) Standard_OVERRIDE;
0380 
0381   //! computes the intersection of three chamfers on
0382   //! the vertex of index <Index> in myVDataMap.
0383   Standard_EXPORT void PerformThreeCorner(const Standard_Integer Index) Standard_OVERRIDE;
0384 
0385   //! extends  the spine  of  the Stripe  <S> at  the
0386   //! extremity of the vertex <V>.
0387   Standard_EXPORT void ExtentOneCorner(const TopoDS_Vertex&         V,
0388                                        const Handle(ChFiDS_Stripe)& S) Standard_OVERRIDE;
0389 
0390   //! extends the spine of the 2 stripes of <LS> at the
0391   //! extremity of the vertex <V>
0392   Standard_EXPORT void ExtentTwoCorner(const TopoDS_Vertex&       V,
0393                                        const ChFiDS_ListOfStripe& LS) Standard_OVERRIDE;
0394 
0395   //! extends the spine of the 2 stripes of <LS> at the
0396   //! extremity of the vertex <V>
0397   Standard_EXPORT void ExtentThreeCorner(const TopoDS_Vertex&       V,
0398                                          const ChFiDS_ListOfStripe& LS) Standard_OVERRIDE;
0399 
0400   //! set the regularities
0401   Standard_EXPORT void SetRegul() Standard_OVERRIDE;
0402 
0403 private:
0404   Standard_EXPORT void ConexFaces(const Handle(ChFiDS_Spine)& Sp,
0405                                   const Standard_Integer      IEdge,
0406                                   TopoDS_Face&                F1,
0407                                   TopoDS_Face&                F2) const;
0408 
0409   ChFiDS_ChamfMode myMode;
0410 };
0411 
0412 #endif // _ChFi3d_ChBuilder_HeaderFile