1 // Created on: 1993-02-05 2 // Created by: Jacques GOUSSARD 3 // Copyright (c) 1993-1999 Matra Datavision 4 // Copyright (c) 1999-2014 OPEN CASCADE SAS 5 // 6 // This file is part of Open CASCADE Technology software library. 7 // 8 // This library is free software; you can redistribute it and/or modify it under 9 // the terms of the GNU Lesser General Public License version 2.1 as published 10 // by the Free Software Foundation, with special exception defined in the file 11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 12 // distribution for complete text of the license and disclaimer of any warranty. 13 // 14 // Alternatively, this file may be used under the terms of Open CASCADE 15 // commercial license or contractual agreement. 16 17 #ifndef _Contap_TheIWalking_HeaderFile 18 #define _Contap_TheIWalking_HeaderFile 19 20 #include <Adaptor3d_Surface.hxx> 21 #include <IntSurf_SequenceOfPathPoint.hxx> 22 #include <math_Vector.hxx> 23 #include <IntWalk_VectorOfWalkingData.hxx> 24 #include <IntWalk_VectorOfInteger.hxx> 25 #include <IntSurf_PntOn2S.hxx> 26 #include <gp_Vec.hxx> 27 #include <gp_Dir2d.hxx> 28 #include <TColStd_SequenceOfInteger.hxx> 29 #include <TColStd_DataMapOfIntegerListOfInteger.hxx> 30 #include <Contap_SequenceOfIWLineOfTheIWalking.hxx> 31 #include <IntSurf_SequenceOfInteriorPoint.hxx> 32 #include <TColStd_SequenceOfReal.hxx> 33 #include <IntWalk_StatusDeflection.hxx> 34 #include <Bnd_Range.hxx> 35 36 class IntSurf_PathPoint; 37 class IntSurf_PathPointTool; 38 class IntSurf_InteriorPoint; 39 class IntSurf_InteriorPointTool; 40 class Adaptor3d_HSurfaceTool; 41 class Contap_SurfFunction; 42 class Contap_TheIWLineOfTheIWalking; 43 class math_FunctionSetRoot; 44 45 class Contap_TheIWalking 46 { 47 public: 48 49 DEFINE_STANDARD_ALLOC 50 51 52 //! Deflection is the maximum deflection admitted between two 53 //! consecutive points on a resulting polyline. 54 //! Step is the maximum increment admitted between two 55 //! consecutive points (in 2d space). 56 //! Epsilon is the tolerance beyond which 2 points 57 //! are confused. 58 //! theToFillHoles is the flag defining whether possible holes 59 //! between resulting curves are filled or not 60 //! in case of Contap walking theToFillHoles is True 61 Standard_EXPORT Contap_TheIWalking(const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Step, 62 const Standard_Boolean theToFillHoles = Standard_False); 63 64 //! Deflection is the maximum deflection admitted between two 65 //! consecutive points on a resulting polyline. 66 //! Step is the maximum increment admitted between two 67 //! consecutive points (in 2d space). 68 //! Epsilon is the tolerance beyond which 2 points 69 //! are confused 70 void SetTolerance (const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Step); 71 72 //! Searches a set of polylines starting on a point of Pnts1 73 //! or Pnts2. 74 //! Each point on a resulting polyline verifies F(u,v)=0 75 Standard_EXPORT void Perform (const IntSurf_SequenceOfPathPoint& Pnts1, const IntSurf_SequenceOfInteriorPoint& Pnts2, Contap_SurfFunction& Func, const Handle(Adaptor3d_Surface)& S, const Standard_Boolean Reversed = Standard_False); 76 77 //! Searches a set of polylines starting on a point of Pnts1. 78 //! Each point on a resulting polyline verifies F(u,v)=0 79 Standard_EXPORT void Perform (const IntSurf_SequenceOfPathPoint& Pnts1, Contap_SurfFunction& Func, const Handle(Adaptor3d_Surface)& S, const Standard_Boolean Reversed = Standard_False); 80 81 //! Returns true if the calculus was successful. 82 Standard_Boolean IsDone() const; 83 84 //! Returns the number of resulting polylines. 85 //! An exception is raised if IsDone returns False. 86 Standard_Integer NbLines() const; 87 88 //! Returns the polyline of range Index. 89 //! An exception is raised if IsDone is False. 90 //! An exception is raised if Index<=0 or Index>NbLines. 91 const Handle(Contap_TheIWLineOfTheIWalking)& Value (const Standard_Integer Index) const; 92 93 //! Returns the number of points belonging to Pnts on which no 94 //! line starts or ends. 95 //! An exception is raised if IsDone returns False. 96 Standard_Integer NbSinglePnts() const; 97 98 //! Returns the point of range Index . 99 //! An exception is raised if IsDone returns False. 100 //! An exception is raised if Index<=0 or 101 //! Index > NbSinglePnts. 102 const IntSurf_PathPoint& SinglePnt (const Standard_Integer Index) const; 103 104 105 106 107 protected: 108 109 110 Standard_EXPORT Standard_Boolean Cadrage (math_Vector& BornInf, math_Vector& BornSup, math_Vector& UVap, Standard_Real& Step, const Standard_Integer StepSign) const; 111 112 Standard_EXPORT Standard_Boolean TestArretPassage (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, Contap_SurfFunction& Section, math_Vector& UV, Standard_Integer& Irang); 113 114 Standard_EXPORT Standard_Boolean TestArretPassage (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, const math_Vector& UV, const Standard_Integer Index, Standard_Integer& Irang); 115 116 Standard_EXPORT Standard_Boolean TestArretAjout (Contap_SurfFunction& Section, math_Vector& UV, Standard_Integer& Irang, IntSurf_PntOn2S& PSol); 117 118 Standard_EXPORT void FillPntsInHoles (Contap_SurfFunction& Section, 119 TColStd_SequenceOfInteger& CopySeqAlone, 120 IntSurf_SequenceOfInteriorPoint& PntsInHoles); 121 122 Standard_EXPORT void TestArretCadre (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, const Handle(Contap_TheIWLineOfTheIWalking)& Line, Contap_SurfFunction& Section, math_Vector& UV, Standard_Integer& Irang); 123 124 Standard_EXPORT IntWalk_StatusDeflection TestDeflection (Contap_SurfFunction& Section, const Standard_Boolean Finished, const math_Vector& UV, const IntWalk_StatusDeflection StatusPrecedent, Standard_Integer& NbDivision, Standard_Real& Step, const Standard_Integer StepSign); 125 126 Standard_EXPORT void ComputeOpenLine (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, const IntSurf_SequenceOfPathPoint& Pnts1, Contap_SurfFunction& Section, Standard_Boolean& Rajout); 127 128 Standard_EXPORT void OpenLine (const Standard_Integer N, const IntSurf_PntOn2S& Psol, const IntSurf_SequenceOfPathPoint& Pnts1, Contap_SurfFunction& Section, const Handle(Contap_TheIWLineOfTheIWalking)& Line); 129 130 Standard_EXPORT Standard_Boolean IsValidEndPoint (const Standard_Integer IndOfPoint, const Standard_Integer IndOfLine); 131 132 Standard_EXPORT void RemoveTwoEndPoints (const Standard_Integer IndOfPoint); 133 134 Standard_EXPORT Standard_Boolean IsPointOnLine (const gp_Pnt2d& theP2d, const Standard_Integer Irang); 135 136 Standard_EXPORT void ComputeCloseLine (const TColStd_SequenceOfReal& Umult, const TColStd_SequenceOfReal& Vmult, const IntSurf_SequenceOfPathPoint& Pnts1, const IntSurf_SequenceOfInteriorPoint& Pnts2, Contap_SurfFunction& Section, Standard_Boolean& Rajout); 137 138 Standard_EXPORT void AddPointInCurrentLine (const Standard_Integer N, const IntSurf_PathPoint& PathPnt, const Handle(Contap_TheIWLineOfTheIWalking)& CurrentLine) const; 139 140 Standard_EXPORT void MakeWalkingPoint (const Standard_Integer Case, const Standard_Real U, const Standard_Real V, Contap_SurfFunction& Section, IntSurf_PntOn2S& Psol); 141 142 //! Clears up internal containers 143 Standard_EXPORT void Clear(); 144 145 //! Returns TRUE if thePOn2S is in one of existing lines. 146 Standard_EXPORT Standard_Boolean IsPointOnLine(const IntSurf_PntOn2S& thePOn2S, 147 const math_Vector& theInfBounds, 148 const math_Vector& theSupBounds, 149 math_FunctionSetRoot& theSolver, 150 Contap_SurfFunction& theFunc); 151 152 153 private: 154 155 156 157 Standard_Boolean done; 158 IntSurf_SequenceOfPathPoint seqSingle; 159 Standard_Real fleche; 160 Standard_Real pas; 161 math_Vector tolerance; 162 Standard_Real epsilon; 163 Standard_Boolean reversed; 164 IntWalk_VectorOfWalkingData wd1; 165 IntWalk_VectorOfWalkingData wd2; 166 IntWalk_VectorOfInteger nbMultiplicities; 167 Bnd_Range mySRangeU; // Estimated U-range for section curve 168 Bnd_Range mySRangeV; // Estimated V-range for section curve 169 Standard_Real Um; 170 Standard_Real UM; 171 Standard_Real Vm; 172 Standard_Real VM; 173 IntSurf_PntOn2S previousPoint; 174 gp_Vec previousd3d; 175 gp_Dir2d previousd2d; 176 TColStd_SequenceOfInteger seqAjout; 177 TColStd_SequenceOfInteger seqAlone; 178 TColStd_DataMapOfIntegerListOfInteger PointLineLine; 179 Contap_SequenceOfIWLineOfTheIWalking lines; 180 Standard_Boolean ToFillHoles; 181 182 183 }; 184 185 #define ThePointOfPath IntSurf_PathPoint 186 #define ThePointOfPath_hxx <IntSurf_PathPoint.hxx> 187 #define ThePointOfPathTool IntSurf_PathPointTool 188 #define ThePointOfPathTool_hxx <IntSurf_PathPointTool.hxx> 189 #define ThePOPIterator IntSurf_SequenceOfPathPoint 190 #define ThePOPIterator_hxx <IntSurf_SequenceOfPathPoint.hxx> 191 #define ThePointOfLoop IntSurf_InteriorPoint 192 #define ThePointOfLoop_hxx <IntSurf_InteriorPoint.hxx> 193 #define ThePointOfLoopTool IntSurf_InteriorPointTool 194 #define ThePointOfLoopTool_hxx <IntSurf_InteriorPointTool.hxx> 195 #define ThePOLIterator IntSurf_SequenceOfInteriorPoint 196 #define ThePOLIterator_hxx <IntSurf_SequenceOfInteriorPoint.hxx> 197 #define ThePSurface Handle(Adaptor3d_Surface) 198 #define ThePSurface_hxx <Adaptor3d_Surface.hxx> 199 #define ThePSurfaceTool Adaptor3d_HSurfaceTool 200 #define ThePSurfaceTool_hxx <Adaptor3d_HSurfaceTool.hxx> 201 #define TheIWFunction Contap_SurfFunction 202 #define TheIWFunction_hxx <Contap_SurfFunction.hxx> 203 #define IntWalk_TheIWLine Contap_TheIWLineOfTheIWalking 204 #define IntWalk_TheIWLine_hxx <Contap_TheIWLineOfTheIWalking.hxx> 205 #define IntWalk_SequenceOfIWLine Contap_SequenceOfIWLineOfTheIWalking 206 #define IntWalk_SequenceOfIWLine_hxx <Contap_SequenceOfIWLineOfTheIWalking.hxx> 207 #define Handle_IntWalk_TheIWLine Handle(Contap_TheIWLineOfTheIWalking) 208 #define IntWalk_IWalking Contap_TheIWalking 209 #define IntWalk_IWalking_hxx <Contap_TheIWalking.hxx> 210 211 #include <IntWalk_IWalking.lxx> 212 213 #undef ThePointOfPath 214 #undef ThePointOfPath_hxx 215 #undef ThePointOfPathTool 216 #undef ThePointOfPathTool_hxx 217 #undef ThePOPIterator 218 #undef ThePOPIterator_hxx 219 #undef ThePointOfLoop 220 #undef ThePointOfLoop_hxx 221 #undef ThePointOfLoopTool 222 #undef ThePointOfLoopTool_hxx 223 #undef ThePOLIterator 224 #undef ThePOLIterator_hxx 225 #undef ThePSurface 226 #undef ThePSurface_hxx 227 #undef ThePSurfaceTool 228 #undef ThePSurfaceTool_hxx 229 #undef TheIWFunction 230 #undef TheIWFunction_hxx 231 #undef IntWalk_TheIWLine 232 #undef IntWalk_TheIWLine_hxx 233 #undef IntWalk_SequenceOfIWLine 234 #undef IntWalk_SequenceOfIWLine_hxx 235 #undef Handle_IntWalk_TheIWLine 236 #undef IntWalk_IWalking 237 #undef IntWalk_IWalking_hxx 238 239 240 241 242 #endif // _Contap_TheIWalking_HeaderFile 243