Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:18:05

0001 // Created on: 1992-05-06
0002 // Created by: Jacques GOUSSARD
0003 // Copyright (c) 1992-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 _IntPatch_TheIWalking_HeaderFile
0018 #define _IntPatch_TheIWalking_HeaderFile
0019 
0020 #include <Adaptor3d_Surface.hxx>
0021 #include <IntSurf_PathPoint.hxx>
0022 #include <NCollection_Sequence.hxx>
0023 #include <math_Vector.hxx>
0024 #include <IntWalk_VectorOfWalkingData.hxx>
0025 #include <IntWalk_VectorOfInteger.hxx>
0026 #include <IntSurf_PntOn2S.hxx>
0027 #include <gp_Vec.hxx>
0028 #include <gp_Dir2d.hxx>
0029 #include <Standard_Integer.hxx>
0030 #include <NCollection_List.hxx>
0031 #include <NCollection_DataMap.hxx>
0032 #include <IntPatch_TheIWLineOfTheIWalking.hxx>
0033 #include <IntSurf_InteriorPoint.hxx>
0034 #include <IntWalk_StatusDeflection.hxx>
0035 #include <Bnd_Range.hxx>
0036 
0037 class IntSurf_PathPoint;
0038 class IntSurf_PathPointTool;
0039 class IntSurf_InteriorPoint;
0040 class IntSurf_InteriorPointTool;
0041 class Adaptor3d_HSurfaceTool;
0042 class IntPatch_TheSurfFunction;
0043 class IntPatch_TheIWLineOfTheIWalking;
0044 class IntSurf_PntOn2S;
0045 class math_FunctionSetRoot;
0046 
0047 class IntPatch_TheIWalking
0048 {
0049 public:
0050   DEFINE_STANDARD_ALLOC
0051 
0052   //! Deflection is the maximum deflection admitted between two
0053   //! consecutive points on a resulting polyline.
0054   //! Step is the maximum increment admitted between two
0055   //! consecutive points (in 2d space).
0056   //! Epsilon is the tolerance beyond which 2 points
0057   //! are confused.
0058   //! theToFillHoles is the flag defining whether possible holes
0059   //! between resulting curves are filled or not
0060   //! in case of IntPatch walking theToFillHoles is False
0061   Standard_EXPORT IntPatch_TheIWalking(const double Epsilon,
0062                                        const double Deflection,
0063                                        const double Step,
0064                                        const bool   theToFillHoles = false);
0065 
0066   //! Deflection is the maximum deflection admitted between two
0067   //! consecutive points on a resulting polyline.
0068   //! Step is the maximum increment admitted between two
0069   //! consecutive points (in 2d space).
0070   //! Epsilon is the tolerance beyond which 2 points
0071   //! are confused
0072   void SetTolerance(const double Epsilon, const double Deflection, const double Step);
0073 
0074   //! Searches a set of polylines starting on a point of Pnts1
0075   //! or Pnts2.
0076   //! Each point on a resulting polyline verifies F(u,v)=0
0077   Standard_EXPORT void Perform(const NCollection_Sequence<IntSurf_PathPoint>&     Pnts1,
0078                                const NCollection_Sequence<IntSurf_InteriorPoint>& Pnts2,
0079                                IntPatch_TheSurfFunction&                          Func,
0080                                const occ::handle<Adaptor3d_Surface>&              S,
0081                                const bool                                         Reversed = false);
0082 
0083   //! Searches a set of polylines starting on a point of Pnts1.
0084   //! Each point on a resulting polyline verifies F(u,v)=0
0085   Standard_EXPORT void Perform(const NCollection_Sequence<IntSurf_PathPoint>& Pnts1,
0086                                IntPatch_TheSurfFunction&                      Func,
0087                                const occ::handle<Adaptor3d_Surface>&          S,
0088                                const bool                                     Reversed = false);
0089 
0090   //! Returns true if the calculus was successful.
0091   bool IsDone() const;
0092 
0093   //! Returns the number of resulting polylines.
0094   //! An exception is raised if IsDone returns False.
0095   int NbLines() const;
0096 
0097   //! Returns the polyline of range Index.
0098   //! An exception is raised if IsDone is False.
0099   //! An exception is raised if Index<=0 or Index>NbLines.
0100   const occ::handle<IntPatch_TheIWLineOfTheIWalking>& Value(const int Index) const;
0101 
0102   //! Returns the number of points belonging to Pnts on which no
0103   //! line starts or ends.
0104   //! An exception is raised if IsDone returns False.
0105   int NbSinglePnts() const;
0106 
0107   //! Returns the point of range Index .
0108   //! An exception is raised if IsDone returns False.
0109   //! An exception is raised if Index<=0 or
0110   //! Index > NbSinglePnts.
0111   const IntSurf_PathPoint& SinglePnt(const int Index) const;
0112 
0113 protected:
0114   Standard_EXPORT bool Cadrage(math_Vector& BornInf,
0115                                math_Vector& BornSup,
0116                                math_Vector& UVap,
0117                                double&      Step,
0118                                const int    StepSign) const;
0119 
0120   Standard_EXPORT bool TestArretPassage(const NCollection_Sequence<double>& Umult,
0121                                         const NCollection_Sequence<double>& Vmult,
0122                                         IntPatch_TheSurfFunction&           Section,
0123                                         math_Vector&                        UV,
0124                                         int&                                Irang);
0125 
0126   Standard_EXPORT bool TestArretPassage(const NCollection_Sequence<double>& Umult,
0127                                         const NCollection_Sequence<double>& Vmult,
0128                                         const math_Vector&                  UV,
0129                                         const int                           Index,
0130                                         int&                                Irang);
0131 
0132   Standard_EXPORT bool TestArretAjout(IntPatch_TheSurfFunction& Section,
0133                                       math_Vector&              UV,
0134                                       int&                      Irang,
0135                                       IntSurf_PntOn2S&          PSol);
0136 
0137   Standard_EXPORT void FillPntsInHoles(IntPatch_TheSurfFunction&                    Section,
0138                                        NCollection_Sequence<int>&                   CopySeqAlone,
0139                                        NCollection_Sequence<IntSurf_InteriorPoint>& PntsInHoles);
0140 
0141   Standard_EXPORT void TestArretCadre(const NCollection_Sequence<double>&                 Umult,
0142                                       const NCollection_Sequence<double>&                 Vmult,
0143                                       const occ::handle<IntPatch_TheIWLineOfTheIWalking>& Line,
0144                                       IntPatch_TheSurfFunction&                           Section,
0145                                       math_Vector&                                        UV,
0146                                       int&                                                Irang);
0147 
0148   Standard_EXPORT IntWalk_StatusDeflection
0149     TestDeflection(IntPatch_TheSurfFunction&      Section,
0150                    const bool                     Finished,
0151                    const math_Vector&             UV,
0152                    const IntWalk_StatusDeflection StatusPrecedent,
0153                    int&                           NbDivision,
0154                    double&                        Step,
0155                    const int                      StepSign);
0156 
0157   Standard_EXPORT void ComputeOpenLine(const NCollection_Sequence<double>&            Umult,
0158                                        const NCollection_Sequence<double>&            Vmult,
0159                                        const NCollection_Sequence<IntSurf_PathPoint>& Pnts1,
0160                                        IntPatch_TheSurfFunction&                      Section,
0161                                        bool&                                          Rajout);
0162 
0163   Standard_EXPORT void OpenLine(const int                                           N,
0164                                 const IntSurf_PntOn2S&                              Psol,
0165                                 const NCollection_Sequence<IntSurf_PathPoint>&      Pnts1,
0166                                 IntPatch_TheSurfFunction&                           Section,
0167                                 const occ::handle<IntPatch_TheIWLineOfTheIWalking>& Line);
0168 
0169   Standard_EXPORT bool IsValidEndPoint(const int IndOfPoint, const int IndOfLine);
0170 
0171   Standard_EXPORT void RemoveTwoEndPoints(const int IndOfPoint);
0172 
0173   Standard_EXPORT bool IsPointOnLine(const gp_Pnt2d& theP2d, const int Irang);
0174 
0175   Standard_EXPORT void ComputeCloseLine(const NCollection_Sequence<double>&                Umult,
0176                                         const NCollection_Sequence<double>&                Vmult,
0177                                         const NCollection_Sequence<IntSurf_PathPoint>&     Pnts1,
0178                                         const NCollection_Sequence<IntSurf_InteriorPoint>& Pnts2,
0179                                         IntPatch_TheSurfFunction&                          Section,
0180                                         bool&                                              Rajout);
0181 
0182   Standard_EXPORT void AddPointInCurrentLine(
0183     const int                                           N,
0184     const IntSurf_PathPoint&                            PathPnt,
0185     const occ::handle<IntPatch_TheIWLineOfTheIWalking>& CurrentLine) const;
0186 
0187   Standard_EXPORT void MakeWalkingPoint(const int                 Case,
0188                                         const double              U,
0189                                         const double              V,
0190                                         IntPatch_TheSurfFunction& Section,
0191                                         IntSurf_PntOn2S&          Psol);
0192 
0193   //! Clears up internal containers
0194   Standard_EXPORT void Clear();
0195 
0196   //! Returns TRUE if thePOn2S is in one of existing lines.
0197   Standard_EXPORT bool IsPointOnLine(const IntSurf_PntOn2S&    thePOn2S,
0198                                      const math_Vector&        theInfBounds,
0199                                      const math_Vector&        theSupBounds,
0200                                      math_FunctionSetRoot&     theSolver,
0201                                      IntPatch_TheSurfFunction& theFunc);
0202 
0203 private:
0204   bool                                            done;
0205   NCollection_Sequence<IntSurf_PathPoint>         seqSingle;
0206   double                                          fleche;
0207   double                                          pas;
0208   math_Vector                                     tolerance;
0209   double                                          epsilon;
0210   bool                                            reversed;
0211   IntWalk_VectorOfWalkingData                     wd1;
0212   IntWalk_VectorOfWalkingData                     wd2;
0213   IntWalk_VectorOfInteger                         nbMultiplicities;
0214   Bnd_Range                                       mySRangeU; // Estimated U-range for section curve
0215   Bnd_Range                                       mySRangeV; // Estimated V-range for section curve
0216   double                                          Um;
0217   double                                          UM;
0218   double                                          Vm;
0219   double                                          VM;
0220   IntSurf_PntOn2S                                 previousPoint;
0221   gp_Vec                                          previousd3d;
0222   gp_Dir2d                                        previousd2d;
0223   NCollection_Sequence<int>                       seqAjout;
0224   NCollection_Sequence<int>                       seqAlone;
0225   NCollection_DataMap<int, NCollection_List<int>> PointLineLine;
0226   NCollection_Sequence<occ::handle<IntPatch_TheIWLineOfTheIWalking>> lines;
0227   bool                                                               ToFillHoles;
0228 };
0229 
0230 #define ThePointOfPath IntSurf_PathPoint
0231 #define ThePointOfPath_hxx <IntSurf_PathPoint.hxx>
0232 #define ThePointOfPathTool IntSurf_PathPointTool
0233 #define ThePointOfPathTool_hxx <IntSurf_PathPointTool.hxx>
0234 #define ThePOPIterator NCollection_Sequence<IntSurf_PathPoint>
0235 #define ThePOPIterator_hxx <NCollection_Sequence<IntSurf_PathPoint>.hxx>
0236 #define ThePointOfLoop IntSurf_InteriorPoint
0237 #define ThePointOfLoop_hxx <IntSurf_InteriorPoint.hxx>
0238 #define ThePointOfLoopTool IntSurf_InteriorPointTool
0239 #define ThePointOfLoopTool_hxx <IntSurf_InteriorPointTool.hxx>
0240 #define ThePOLIterator NCollection_Sequence<IntSurf_InteriorPoint>
0241 #define ThePOLIterator_hxx <NCollection_Sequence<IntSurf_InteriorPoint>.hxx>
0242 #define ThePSurface occ::handle<Adaptor3d_Surface>
0243 #define ThePSurface_hxx <Adaptor3d_Surface.hxx>
0244 #define ThePSurfaceTool Adaptor3d_HSurfaceTool
0245 #define ThePSurfaceTool_hxx <Adaptor3d_HSurfaceTool.hxx>
0246 #define TheIWFunction IntPatch_TheSurfFunction
0247 #define TheIWFunction_hxx <IntPatch_TheSurfFunction.hxx>
0248 #define IntWalk_TheIWLine IntPatch_TheIWLineOfTheIWalking
0249 #define IntWalk_TheIWLine_hxx <IntPatch_TheIWLineOfTheIWalking.hxx>
0250 #define IntWalk_SequenceOfIWLine NCollection_Sequence<occ::handle<IntPatch_TheIWLineOfTheIWalking>>
0251 #define IntWalk_SequenceOfIWLine_hxx                                                               \
0252   <NCollection_Sequence<occ::handle<IntPatch_TheIWLineOfTheIWalking>>.hxx>
0253 #define Handle_IntWalk_TheIWLine occ::handle<IntPatch_TheIWLineOfTheIWalking>
0254 #define IntWalk_IWalking IntPatch_TheIWalking
0255 #define IntWalk_IWalking_hxx <IntPatch_TheIWalking.hxx>
0256 
0257 #include <IntWalk_IWalking.lxx>
0258 
0259 #undef ThePointOfPath
0260 #undef ThePointOfPath_hxx
0261 #undef ThePointOfPathTool
0262 #undef ThePointOfPathTool_hxx
0263 #undef ThePOPIterator
0264 #undef ThePOPIterator_hxx
0265 #undef ThePointOfLoop
0266 #undef ThePointOfLoop_hxx
0267 #undef ThePointOfLoopTool
0268 #undef ThePointOfLoopTool_hxx
0269 #undef ThePOLIterator
0270 #undef ThePOLIterator_hxx
0271 #undef ThePSurface
0272 #undef ThePSurface_hxx
0273 #undef ThePSurfaceTool
0274 #undef ThePSurfaceTool_hxx
0275 #undef TheIWFunction
0276 #undef TheIWFunction_hxx
0277 #undef IntWalk_TheIWLine
0278 #undef IntWalk_TheIWLine_hxx
0279 #undef IntWalk_SequenceOfIWLine
0280 #undef IntWalk_SequenceOfIWLine_hxx
0281 #undef Handle_IntWalk_TheIWLine
0282 #undef IntWalk_IWalking
0283 #undef IntWalk_IWalking_hxx
0284 
0285 #endif // _IntPatch_TheIWalking_HeaderFile