42cf5bc1 |
1 | // Created on: 1994-03-24 |
2 | // Created by: model |
3 | // Copyright (c) 1994-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 _Adaptor3d_TopolTool_HeaderFile |
18 | #define _Adaptor3d_TopolTool_HeaderFile |
19 | |
42cf5bc1 |
20 | #include <TColStd_HArray1OfReal.hxx> |
42cf5bc1 |
21 | #include <TopAbs_State.hxx> |
22 | #include <TopAbs_Orientation.hxx> |
23 | #include <TColStd_Array1OfReal.hxx> |
5b111128 |
24 | #include <Adaptor3d_HVertex.hxx> |
25 | |
42cf5bc1 |
26 | class Adaptor2d_HLine2d; |
27 | class Adaptor3d_HVertex; |
28 | class Adaptor3d_HSurface; |
29 | class Standard_DomainError; |
30 | class Adaptor2d_HCurve2d; |
31 | class gp_Pnt2d; |
32 | class gp_Pnt; |
33 | |
34 | |
35 | class Adaptor3d_TopolTool; |
25e59720 |
36 | DEFINE_STANDARD_HANDLE(Adaptor3d_TopolTool, Standard_Transient) |
42cf5bc1 |
37 | |
38 | //! This class provides a default topological tool, |
39 | //! based on the Umin,Vmin,Umax,Vmax of an HSurface |
40 | //! from Adaptor3d. |
41 | //! All methods and fields may be redefined when |
42 | //! inheriting from this class. |
43 | //! This class is used to instantiate algorithmes |
44 | //! as Intersection, outlines,... |
25e59720 |
45 | class Adaptor3d_TopolTool : public Standard_Transient |
42cf5bc1 |
46 | { |
47 | |
48 | public: |
49 | |
50 | |
51 | Standard_EXPORT Adaptor3d_TopolTool(); |
52 | |
53 | Standard_EXPORT Adaptor3d_TopolTool(const Handle(Adaptor3d_HSurface)& Surface); |
54 | |
55 | Standard_EXPORT virtual void Initialize(); |
56 | |
57 | Standard_EXPORT virtual void Initialize (const Handle(Adaptor3d_HSurface)& S); |
58 | |
59 | Standard_EXPORT virtual void Initialize (const Handle(Adaptor2d_HCurve2d)& Curve); |
60 | |
61 | Standard_EXPORT virtual void Init(); |
62 | |
63 | Standard_EXPORT virtual Standard_Boolean More(); |
64 | |
65 | Standard_EXPORT virtual Handle(Adaptor2d_HCurve2d) Value(); |
66 | |
67 | Standard_EXPORT virtual void Next(); |
68 | |
69 | Standard_EXPORT virtual void InitVertexIterator(); |
70 | |
71 | Standard_EXPORT virtual Standard_Boolean MoreVertex(); |
72 | |
73 | Standard_EXPORT virtual Handle(Adaptor3d_HVertex) Vertex(); |
74 | |
75 | Standard_EXPORT virtual void NextVertex(); |
76 | |
77 | Standard_EXPORT virtual TopAbs_State Classify (const gp_Pnt2d& P, const Standard_Real Tol, const Standard_Boolean ReacdreOnPeriodic = Standard_True); |
78 | |
79 | Standard_EXPORT virtual Standard_Boolean IsThePointOn (const gp_Pnt2d& P, const Standard_Real Tol, const Standard_Boolean ReacdreOnPeriodic = Standard_True); |
80 | |
81 | //! If the function returns the orientation of the arc. |
82 | //! If the orientation is FORWARD or REVERSED, the arc is |
83 | //! a "real" limit of the surface. |
84 | //! If the orientation is INTERNAL or EXTERNAL, the arc is |
85 | //! considered as an arc on the surface. |
86 | Standard_EXPORT virtual TopAbs_Orientation Orientation (const Handle(Adaptor2d_HCurve2d)& C); |
87 | |
88 | //! Returns the orientation of the vertex V. |
89 | //! The vertex has been found with an exploration on |
90 | //! a given arc. The orientation is the orientation |
91 | //! of the vertex on this arc. |
92 | Standard_EXPORT virtual TopAbs_Orientation Orientation (const Handle(Adaptor3d_HVertex)& V); |
93 | |
94 | //! Returns True if the vertices V1 and V2 are identical. |
95 | //! This method does not take the orientation of the |
96 | //! vertices in account. |
97 | Standard_EXPORT virtual Standard_Boolean Identical (const Handle(Adaptor3d_HVertex)& V1, const Handle(Adaptor3d_HVertex)& V2); |
98 | |
99 | //! answers if arcs and vertices may have 3d representations, |
100 | //! so that we could use Tol3d and Pnt methods. |
101 | Standard_EXPORT virtual Standard_Boolean Has3d() const; |
102 | |
103 | //! returns 3d tolerance of the arc C |
104 | Standard_EXPORT virtual Standard_Real Tol3d (const Handle(Adaptor2d_HCurve2d)& C) const; |
105 | |
106 | //! returns 3d tolerance of the vertex V |
107 | Standard_EXPORT virtual Standard_Real Tol3d (const Handle(Adaptor3d_HVertex)& V) const; |
108 | |
109 | //! returns 3d point of the vertex V |
110 | Standard_EXPORT virtual gp_Pnt Pnt (const Handle(Adaptor3d_HVertex)& V) const; |
111 | |
112 | Standard_EXPORT virtual void ComputeSamplePoints(); |
113 | |
114 | //! compute the sample-points for the intersections algorithms |
115 | Standard_EXPORT virtual Standard_Integer NbSamplesU(); |
116 | |
117 | //! compute the sample-points for the intersections algorithms |
118 | Standard_EXPORT virtual Standard_Integer NbSamplesV(); |
119 | |
120 | //! compute the sample-points for the intersections algorithms |
121 | Standard_EXPORT virtual Standard_Integer NbSamples(); |
122 | |
123 | //! return the set of U parameters on the surface |
124 | //! obtained by the method SamplePnts |
125 | Standard_EXPORT void UParameters (TColStd_Array1OfReal& theArray) const; |
126 | |
127 | //! return the set of V parameters on the surface |
128 | //! obtained by the method SamplePnts |
129 | Standard_EXPORT void VParameters (TColStd_Array1OfReal& theArray) const; |
130 | |
131 | Standard_EXPORT virtual void SamplePoint (const Standard_Integer Index, gp_Pnt2d& P2d, gp_Pnt& P3d); |
132 | |
133 | Standard_EXPORT virtual Standard_Boolean DomainIsInfinite(); |
134 | |
135 | Standard_EXPORT virtual Standard_Address Edge() const; |
136 | |
137 | //! compute the sample-points for the intersections algorithms |
138 | //! by adaptive algorithm for BSpline surfaces. For other surfaces algorithm |
139 | //! is the same as in method ComputeSamplePoints(), but only fill arrays of U |
140 | //! and V sample parameters; |
141 | //! theDefl is a requred deflection |
142 | //! theNUmin, theNVmin are minimal nb points for U and V. |
143 | Standard_EXPORT virtual void SamplePnts (const Standard_Real theDefl, const Standard_Integer theNUmin, const Standard_Integer theNVmin); |
144 | |
145 | //! compute the sample-points for the intersections algorithms |
146 | //! by adaptive algorithm for BSpline surfaces - is used in SamplePnts |
147 | //! theDefl is a requred deflection |
148 | //! theNUmin, theNVmin are minimal nb points for U and V. |
149 | Standard_EXPORT virtual void BSplSamplePnts (const Standard_Real theDefl, const Standard_Integer theNUmin, const Standard_Integer theNVmin); |
150 | |
151 | //! Returns true if provide uniform sampling of points. |
152 | Standard_EXPORT virtual Standard_Boolean IsUniformSampling() const; |
153 | |
154 | |
155 | |
156 | |
25e59720 |
157 | DEFINE_STANDARD_RTTIEXT(Adaptor3d_TopolTool,Standard_Transient) |
42cf5bc1 |
158 | |
159 | protected: |
160 | |
161 | |
162 | Handle(Adaptor3d_HSurface) myS; |
163 | Standard_Integer myNbSamplesU; |
164 | Standard_Integer myNbSamplesV; |
165 | Handle(TColStd_HArray1OfReal) myUPars; |
166 | Handle(TColStd_HArray1OfReal) myVPars; |
167 | |
168 | |
169 | private: |
170 | |
171 | |
172 | Standard_Integer nbRestr; |
173 | Standard_Integer idRestr; |
174 | Standard_Real Uinf; |
175 | Standard_Real Usup; |
176 | Standard_Real Vinf; |
177 | Standard_Real Vsup; |
178 | Handle(Adaptor2d_HLine2d) myRestr[4]; |
179 | Standard_Integer nbVtx; |
180 | Standard_Integer idVtx; |
181 | Handle(Adaptor3d_HVertex) myVtx[2]; |
182 | |
183 | |
184 | }; |
185 | |
186 | |
187 | |
188 | |
189 | |
190 | |
191 | |
192 | #endif // _Adaptor3d_TopolTool_HeaderFile |