0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / IntPatch / IntPatch_SpecialPoints.hxx
1 //! Created on: 2016-06-03
2 //! Created by: NIKOLAI BUKHALOV
3 //! Copyright (c) 2016 OPEN CASCADE SAS
4 //!
5 //! This file is part of Open CASCADE Technology software library.
6 //!
7 //! This library is free software; you can redistribute it and/or modify it under
8 //! the terms of the GNU Lesser General Public License version 2.1 as published
9 //! by the Free Software Foundation, with special exception defined in the file
10 //! OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 //! distribution for complete text of the license and disclaimer of any warranty.
12 //!
13 //! Alternatively, this file may be used under the terms of Open CASCADE
14 //! commercial license or contractual agreement.
15
16 #ifndef _IntPatch_SpecialPoints_HeaderFile
17 #define _IntPatch_SpecialPoints_HeaderFile
18
19 //! Contains methods to add some special points
20 //! (such as apex of cone, pole of sphere,
21 //! point on surface boundary etc.) in the intersection line.
22
23 #include <IntPatch_SpecPntType.hxx>
24 #include <Standard_Handle.hxx>
25
26 class Adaptor3d_HSurface;
27 class gp_Cone;
28 class gp_Vec;
29 class gp_XYZ;
30 class IntPatch_Point;
31 class IntSurf_PntOn2S;
32 class math_Vector;
33
34 class IntPatch_SpecialPoints
35 {
36 public:
37   //! Adds the point defined as intersection
38   //! of two isolines (U = 0 and V = 0) on theQSurf in theLine.
39   //! theRefPt is used to correct adjusting parameters.
40   //! If theIsReversed is TRUE then theQSurf correspond to the 
41   //! second (otherwise, the first) surface while forming
42   //! intersection point IntSurf_PntOn2S.
43   Standard_EXPORT static Standard_Boolean 
44                       AddCrossUVIsoPoint(const Handle(Adaptor3d_HSurface)& theQSurf,
45                                          const Handle(Adaptor3d_HSurface)& thePSurf,
46                                          const IntSurf_PntOn2S& theRefPt,
47                                          const Standard_Real theTol3d,
48                                          IntSurf_PntOn2S& theAddedPoint,
49                                          const Standard_Boolean theIsReversed
50                                                                 = Standard_False);
51
52   //! Adds the point lain strictly in the isoline U = 0 or V = 0 of theQSurf,
53   //! in theLine.
54   //! theRefPt is used to correct adjusting parameters.
55   //! If theIsReversed is TRUE then theQSurf corresponds to the 
56   //! second (otherwise, the first) surface while forming
57   //! intersection point IntSurf_PntOn2S.
58   //! All math_Vector-objects must be filled as follows:
59   //!   [1] - U-parameter of thePSurf;
60   //!   [2] - V-parameter of thePSurf;
61   //!   [3] - U- (if V-isoline is considered) or V-parameter
62   //!         (if U-isoline is considered) of theQSurf.
63   Standard_EXPORT static Standard_Boolean
64                       AddPointOnUorVIso(const Handle(Adaptor3d_HSurface)& theQSurf,
65                                         const Handle(Adaptor3d_HSurface)& thePSurf,
66                                         const IntSurf_PntOn2S& theRefPt,
67                                         const Standard_Boolean theIsU,
68                                         const Standard_Real theIsoParameter,
69                                         const math_Vector& theToler,
70                                         const math_Vector& theInitPoint,
71                                         const math_Vector& theInfBound,
72                                         const math_Vector& theSupBound,
73                                         IntSurf_PntOn2S& theAddedPoint,
74                                         const Standard_Boolean theIsReversed
75                                                                 = Standard_False);
76
77   //! Computes the pole of sphere to add it in the intersection line.
78   //! Stores the result in theAddedPoint variable (does not add in the line).
79   //! At that, cone and sphere (with singularity) must be set in theQSurf parameter.
80   //! By default (if theIsReversed == FALSE), theQSurf is the first surface of the
81   //! Walking line. If it is not, theIsReversed parameter must be set to TRUE.
82   //! theIsReqRefCheck is TRUE if and only if 3D-point of theRefPt must be pole or apex
83   //! for check (e.g. if it is vertex).
84   //! thePtIso is the reference point for obtaining isoline where must be placed the Apex/Pole.
85   //!
86   //! ATTENTION!!!
87   //!   theVertex must be initialized before calling the method .
88   Standard_EXPORT static Standard_Boolean
89                       AddSingularPole(const Handle(Adaptor3d_HSurface)& theQSurf,
90                                       const Handle(Adaptor3d_HSurface)& thePSurf,
91                                       const IntSurf_PntOn2S& thePtIso,
92                                       IntPatch_Point& theVertex,
93                                       IntSurf_PntOn2S& theAddedPoint,                                      
94                                       const Standard_Boolean theIsReversed =
95                                                                 Standard_False,
96                                       const Standard_Boolean theIsReqRefCheck = 
97                                                                 Standard_False);
98
99   //! Special point has already been added in the line. Now, we need in correct
100   //! prolongation of the line or in start new line. This function returns new point.
101   //!
102   //! ATTENTION!!!
103   //!   theNewPoint is not only Output parameter. It is Input/Output one. I.e. 
104   //! theNewPoint is reference point together with theRefPt.
105   Standard_EXPORT static Standard_Boolean
106                     ContinueAfterSpecialPoint(const Handle(Adaptor3d_HSurface)& theQSurf,
107                                               const Handle(Adaptor3d_HSurface)& thePSurf,
108                                               const IntSurf_PntOn2S& theRefPt,
109                                               const IntPatch_SpecPntType theSPType,
110                                               const Standard_Real theTol2D,
111                                               IntSurf_PntOn2S& theNewPoint,
112                                               const Standard_Boolean theIsReversed
113                                                                 = Standard_False);
114
115   //! Sets theNewPoint parameters in 2D-space the closest to
116   //! theRefPoint with help of adding/subtracting corresponding periods.
117   //! theArrPeriods must be filled as follows:
118   //! {<U-period of 1st surface>, <V-period of 1st surface>,
119   //!  <U-period of 2nd surface>, <V-period of 2nd surface>}.
120   //! If theVertex != 0 then its parameters will be filled as
121   //! corresponding parameters of theNewPoint.
122   //!
123   //! ATTENTION!!!
124   //!   theNewPoint is not only Output parameter. It is Input/Output one. I.e. 
125   //! theNewPoint is reference point together with theRefPt.
126   Standard_EXPORT static void 
127                       AdjustPointAndVertex(const IntSurf_PntOn2S &theRefPoint,
128                                            const Standard_Real theArrPeriods[4],
129                                            IntSurf_PntOn2S &theNewPoint,
130                                            IntPatch_Point* const theVertex = 0);
131
132 protected:
133   //! Computes "special point" in the sphere
134   //! The parameter will be found in the range [0, 2*PI].
135   //! Therefore it must be adjusted to valid range by
136   //! the high-level algorithm
137   static Standard_EXPORT Standard_Boolean ProcessSphere(const IntSurf_PntOn2S& thePtIso,
138                                                         const gp_Vec& theDUofPSurf,
139                                                         const gp_Vec& theDVofPSurf,
140                                                         const Standard_Boolean theIsReversed,
141                                                         const Standard_Real theVquad,
142                                                         Standard_Real& theUquad,
143                                                         Standard_Boolean& theIsIsoChoosen);
144
145   //! Computes "special point" in the cone.
146   //! The parameter will be found in the range [0, 2*PI].
147   //! Therefore it must be adjusted to valid range by
148   //! the high-level algorithm.
149   static Standard_EXPORT Standard_Boolean ProcessCone(const IntSurf_PntOn2S& thePtIso,
150                                                       const gp_Vec& theDUofPSurf,
151                                                       const gp_Vec& theDVofPSurf,
152                                                       const gp_Cone& theCone,
153                                                       const Standard_Boolean theIsReversed,
154                                                       Standard_Real& theUquad,
155                                                       Standard_Boolean& theIsIsoChoosen);
156
157   //! Computes vector tangent to the intersection line in cone apex.
158   //! There exist not more than 2 tangent. They will be stores in theResult vector.
159   //! Returns the number of found tangents.
160   //! thePlnNormal is the normalized vector of the normal to the plane intersected the cone.
161   static Standard_EXPORT Standard_Integer GetTangentToIntLineForCone(const Standard_Real theConeSemiAngle,
162                                                                      const gp_XYZ& thePlnNormal,
163                                                                      gp_XYZ theResult[2]);
164 };
165
166 #endif // _IntPatch_AddSpecialPoints_HeaderFile