42cf5bc1 |
1 | // Created on: 1992-01-30 |
2 | // Created by: Didier PIFFAULT |
3 | // Copyright (c) 1992-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 _TopTrans_SurfaceTransition_HeaderFile |
18 | #define _TopTrans_SurfaceTransition_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <gp_Dir.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <TColStd_Array2OfReal.hxx> |
27 | #include <TopTrans_Array2OfOrientation.hxx> |
28 | #include <Standard_Boolean.hxx> |
29 | #include <TopAbs_Orientation.hxx> |
30 | #include <TopAbs_State.hxx> |
31 | class gp_Dir; |
32 | |
33 | |
34 | //! This algorithm is used to compute the transition |
35 | //! of a 3D surface intersecting a topological surfacic |
36 | //! boundary on a 3D curve ( intersection curve ). |
37 | //! The boundary is described by a set of faces |
38 | //! each face is described by |
39 | //! - its support surface, |
40 | //! - an orientation defining its matter side. |
41 | //! The geometric elements are described locally at the |
42 | //! intersection point by a second order development. |
43 | //! A surface is described by the normal vector, the |
44 | //! principal directions and the principal curvatures. |
45 | //! A curve is described by the tangent, the normal |
46 | //! and the curvature. |
47 | //! The algorithm keeps track of the two faces elements |
48 | //! closest to the part of the curve "before" and "after" |
49 | //! the intersection, these two elements are updated |
50 | //! for each new face. |
51 | //! The position of the curve can be computed when at |
52 | //! least one surface element has been given, this |
53 | //! position is "In","Out" or "On" for the part of the |
54 | //! curve "Before" or "After" the intersection. |
55 | class TopTrans_SurfaceTransition |
56 | { |
57 | public: |
58 | |
59 | DEFINE_STANDARD_ALLOC |
60 | |
61 | |
62 | //! Create an empty Surface Transition. |
63 | Standard_EXPORT TopTrans_SurfaceTransition(); |
64 | |
65 | //! Initialize a Surface Transition with the local |
66 | //! description of the intersection curve and of the |
67 | //! reference surface. |
68 | //! PREQUESITORY : Norm oriented OUTSIDE "geometric matter" |
69 | Standard_EXPORT void Reset (const gp_Dir& Tgt, const gp_Dir& Norm, const gp_Dir& MaxD, const gp_Dir& MinD, const Standard_Real MaxCurv, const Standard_Real MinCurv); |
70 | |
71 | //! Initialize a Surface Transition with the local |
72 | //! description of a straight line. |
73 | Standard_EXPORT void Reset (const gp_Dir& Tgt, const gp_Dir& Norm); |
74 | |
75 | //! Add a face element to the boundary. |
76 | //! |
77 | //! - S defines topological orientation for the face : |
78 | //! S FORWARD means: along the intersection curve on the |
79 | //! reference surface, transition states while crossing |
80 | //! the face are OUT,IN. |
81 | //! S REVERSED means states are IN,OUT. |
82 | //! S INTERNAL means states are IN,IN. |
83 | //! |
84 | //! - O defines curve's position on face : |
85 | //! O FORWARD means the face is before the intersection |
86 | //! O REVERSED means the face is AFTER |
87 | //! O INTERNAL means the curve intersection is in the face. |
88 | //! PREQUESITORY : Norm oriented OUTSIDE "geometric matter" |
89 | Standard_EXPORT void Compare (const Standard_Real Tole, const gp_Dir& Norm, const gp_Dir& MaxD, const gp_Dir& MinD, const Standard_Real MaxCurv, const Standard_Real MinCurv, const TopAbs_Orientation S, const TopAbs_Orientation O); |
90 | |
91 | //! Add a plane or a cylindric face to the boundary. |
92 | Standard_EXPORT void Compare (const Standard_Real Tole, const gp_Dir& Norm, const TopAbs_Orientation S, const TopAbs_Orientation O); |
93 | |
94 | //! Returns the state of the reference surface before |
95 | //! the interference, this is the position relative to |
96 | //! the surface of a point very close to the intersection |
97 | //! on the negative side of the tangent. |
98 | Standard_EXPORT TopAbs_State StateBefore() const; |
99 | |
100 | //! Returns the state of the reference surface after |
101 | //! interference, this is the position relative to the |
102 | //! surface of a point very close to the intersection |
103 | //! on the positive side of the tangent. |
104 | Standard_EXPORT TopAbs_State StateAfter() const; |
105 | |
106 | Standard_EXPORT static TopAbs_State GetBefore (const TopAbs_Orientation Tran); |
107 | |
108 | Standard_EXPORT static TopAbs_State GetAfter (const TopAbs_Orientation Tran); |
109 | |
110 | |
111 | |
112 | |
113 | protected: |
114 | |
115 | |
116 | |
117 | |
118 | |
119 | private: |
120 | |
121 | |
122 | Standard_EXPORT void UpdateReference (const Standard_Real Tole, const Standard_Boolean isInfRef, Standard_Real& CosInf, Standard_Real& CosSup, const TopAbs_Orientation Tran, TopAbs_Orientation& TranRef); |
123 | |
124 | Standard_EXPORT Standard_Real ComputeCos (const Standard_Real Tole, const gp_Dir& Norm, const TopAbs_Orientation O, Standard_Boolean& isleft) const; |
125 | |
126 | |
127 | gp_Dir myTgt; |
128 | gp_Dir myNorm; |
129 | gp_Dir beafter; |
130 | Standard_Real myCurvRef; |
131 | TColStd_Array2OfReal myAng; |
132 | TColStd_Array2OfReal myCurv; |
133 | TopTrans_Array2OfOrientation myOri; |
134 | Standard_Boolean myTouchFlag; |
135 | |
136 | |
137 | }; |
138 | |
139 | |
140 | |
141 | |
142 | |
143 | |
144 | |
145 | #endif // _TopTrans_SurfaceTransition_HeaderFile |