0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / IntAna / IntAna_QuadQuadGeo.hxx
CommitLineData
42cf5bc1 1// Created on: 1992-08-06
2// Created by: Laurent BUCHARD
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 _IntAna_QuadQuadGeo_HeaderFile
18#define _IntAna_QuadQuadGeo_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Boolean.hxx>
25#include <Standard_Integer.hxx>
26#include <IntAna_ResultType.hxx>
27#include <gp_Pnt.hxx>
28#include <gp_Dir.hxx>
29#include <Standard_Real.hxx>
30class StdFail_NotDone;
31class Standard_DomainError;
32class Standard_OutOfRange;
33class gp_Pln;
34class gp_Cylinder;
35class gp_Sphere;
36class gp_Cone;
37class gp_Torus;
38class gp_Pnt;
39class gp_Lin;
40class gp_Circ;
41class gp_Elips;
42class gp_Parab;
43class gp_Hypr;
44
45
46//! Geometric intersections between two natural quadrics
47//! (Sphere , Cylinder , Cone , Pln from gp).
48//! The possible intersections are :
49//! - 1 point
50//! - 1 or 2 line(s)
51//! - 1 Point and 1 Line
52//! - 1 circle
53//! - 1 ellipse
54//! - 1 parabola
55//! - 1 or 2 hyperbola(s).
56//! - Empty : there is no intersection between the two quadrics.
57//! - Same : the quadrics are identical
58//! - NoGeometricSolution : there may be an intersection, but it
59//! is necessary to use an analytic algorithm to determine
60//! it. See class IntQuadQuad from IntAna.
61class IntAna_QuadQuadGeo
62{
63public:
64
65 DEFINE_STANDARD_ALLOC
66
67
68 //! Empty constructor.
69 Standard_EXPORT IntAna_QuadQuadGeo();
70
71 //! Creates the intersection between two planes.
72 //! TolAng is the angular tolerance used to determine
73 //! if the planes are parallel.
74 //! Tol is the tolerance used to determine if the planes
75 //! are identical (only when they are parallel).
76 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Pln& P1, const gp_Pln& P2, const Standard_Real TolAng, const Standard_Real Tol);
77
78 //! Intersects two planes.
79 //! TolAng is the angular tolerance used to determine
80 //! if the planes are parallel.
81 //! Tol is the tolerance used to determine if the planes
82 //! are identical (only when they are parallel).
83 Standard_EXPORT void Perform (const gp_Pln& P1, const gp_Pln& P2, const Standard_Real TolAng, const Standard_Real Tol);
84
85 //! Creates the intersection between a plane and a cylinder.
86 //! TolAng is the angular tolerance used to determine
87 //! if the axis of the cylinder is parallel to the plane.
88 //! Tol is the tolerance used to determine if the result
89 //! is a circle or an ellipse. If the maximum distance between
90 //! the ellipse solution and the circle centered at the ellipse
91 //! center is less than Tol, the result will be the circle.
92 //! H is the height of the cylinder <Cyl>. It is used to check
93 //! whether the plane and cylinder are parallel.
94 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Pln& P, const gp_Cylinder& C, const Standard_Real Tolang, const Standard_Real Tol, const Standard_Real H = 0);
95
96 //! Intersects a plane and a cylinder.
97 //! TolAng is the angular tolerance used to determine
98 //! if the axis of the cylinder is parallel to the plane.
99 //! Tol is the tolerance used to determine if the result
100 //! is a circle or an ellipse. If the maximum distance between
101 //! the ellipse solution and the circle centered at the ellipse
102 //! center is less than Tol, the result will be the circle.
103 //! H is the height of the cylinder <Cyl>. It is used to check
104 //! whether the plane and cylinder are parallel.
105 Standard_EXPORT void Perform (const gp_Pln& P, const gp_Cylinder& C, const Standard_Real Tolang, const Standard_Real Tol, const Standard_Real H = 0);
106
107 //! Creates the intersection between a plane and a sphere.
108 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Pln& P, const gp_Sphere& S);
109
110 //! Intersects a plane and a sphere.
111 Standard_EXPORT void Perform (const gp_Pln& P, const gp_Sphere& S);
112
113 //! Creates the intersection between a plane and a cone.
114 //! TolAng is the angular tolerance used to determine
115 //! if the axis of the cone is parallel or perpendicular
116 //! to the plane, and if the generating line of the cone
117 //! is parallel to the plane.
118 //! Tol is the tolerance used to determine if the apex
119 //! of the cone is in the plane.
120 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Pln& P, const gp_Cone& C, const Standard_Real Tolang, const Standard_Real Tol);
121
122 //! Intersects a plane and a cone.
123 //! TolAng is the angular tolerance used to determine
124 //! if the axis of the cone is parallel or perpendicular
125 //! to the plane, and if the generating line of the cone
126 //! is parallel to the plane.
127 //! Tol is the tolerance used to determine if the apex
128 //! of the cone is in the plane.
129 Standard_EXPORT void Perform (const gp_Pln& P, const gp_Cone& C, const Standard_Real Tolang, const Standard_Real Tol);
130
131 //! Creates the intersection between two cylinders.
132 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Cylinder& Cyl1, const gp_Cylinder& Cyl2, const Standard_Real Tol);
133
134 //! Intersects two cylinders
135 Standard_EXPORT void Perform (const gp_Cylinder& Cyl1, const gp_Cylinder& Cyl2, const Standard_Real Tol);
136
137 //! Creates the intersection between a Cylinder and a Sphere.
138 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Cylinder& Cyl, const gp_Sphere& Sph, const Standard_Real Tol);
139
140 //! Intersects a cylinder and a sphere.
141 Standard_EXPORT void Perform (const gp_Cylinder& Cyl, const gp_Sphere& Sph, const Standard_Real Tol);
142
143 //! Creates the intersection between a Cylinder and a Cone
144 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Cylinder& Cyl, const gp_Cone& Con, const Standard_Real Tol);
145
146 //! Intersects a cylinder and a cone.
147 Standard_EXPORT void Perform (const gp_Cylinder& Cyl, const gp_Cone& Con, const Standard_Real Tol);
148
149 //! Creates the intersection between two Spheres.
150 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Sphere& Sph1, const gp_Sphere& Sph2, const Standard_Real Tol);
151
152 //! Intersects a two spheres.
153 Standard_EXPORT void Perform (const gp_Sphere& Sph1, const gp_Sphere& Sph2, const Standard_Real Tol);
154
155 //! Creates the intersection beween a Sphere and a Cone.
156 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Sphere& Sph, const gp_Cone& Con, const Standard_Real Tol);
157
158 //! Intersects a sphere and a cone.
159 Standard_EXPORT void Perform (const gp_Sphere& Sph, const gp_Cone& Con, const Standard_Real Tol);
160
161 //! Creates the intersection beween two cones.
162 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Cone& Con1, const gp_Cone& Con2, const Standard_Real Tol);
163
164 //! Intersects two cones.
165 Standard_EXPORT void Perform (const gp_Cone& Con1, const gp_Cone& Con2, const Standard_Real Tol);
166
167 //! Creates the intersection beween plane and torus.
168 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Pln& Pln, const gp_Torus& Tor, const Standard_Real Tol);
169
170 //! Intersects plane and torus.
171 Standard_EXPORT void Perform (const gp_Pln& Pln, const gp_Torus& Tor, const Standard_Real Tol);
172
173 //! Creates the intersection beween cylinder and torus.
174 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Cylinder& Cyl, const gp_Torus& Tor, const Standard_Real Tol);
175
176 //! Intersects cylinder and torus.
177 Standard_EXPORT void Perform (const gp_Cylinder& Cyl, const gp_Torus& Tor, const Standard_Real Tol);
178
179 //! Creates the intersection beween cone and torus.
180 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Cone& Con, const gp_Torus& Tor, const Standard_Real Tol);
181
182 //! Intersects cone and torus.
183 Standard_EXPORT void Perform (const gp_Cone& Con, const gp_Torus& Tor, const Standard_Real Tol);
184
185 //! Creates the intersection beween sphere and torus.
186 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Sphere& Sph, const gp_Torus& Tor, const Standard_Real Tol);
187
188 //! Intersects sphere and torus.
189 Standard_EXPORT void Perform (const gp_Sphere& Sph, const gp_Torus& Tor, const Standard_Real Tol);
190
191 //! Creates the intersection beween two toruses.
192 Standard_EXPORT IntAna_QuadQuadGeo(const gp_Torus& Tor1, const gp_Torus& Tor2, const Standard_Real Tol);
193
194 //! Intersects two toruses.
195 Standard_EXPORT void Perform (const gp_Torus& Tor1, const gp_Torus& Tor2, const Standard_Real Tol);
196
197 //! Returns Standard_True if the computation was successful.
198 Standard_Boolean IsDone() const;
199
200 //! Returns the type of intersection.
201 IntAna_ResultType TypeInter() const;
202
203 //! Returns the number of interesections.
204 //! The possible intersections are :
205 //! - 1 point
206 //! - 1 or 2 line(s)
207 //! - 1 Point and 1 Line
208 //! - 1 circle
209 //! - 1 ellipse
210 //! - 1 parabola
211 //! - 1 or 2 hyperbola(s).
212 Standard_Integer NbSolutions() const;
213
214 //! Returns the point solution of range Num.
215 Standard_EXPORT gp_Pnt Point (const Standard_Integer Num) const;
216
217 //! Returns the line solution of range Num.
218 Standard_EXPORT gp_Lin Line (const Standard_Integer Num) const;
219
220 //! Returns the circle solution of range Num.
221 Standard_EXPORT gp_Circ Circle (const Standard_Integer Num) const;
222
223 //! Returns the ellipse solution of range Num.
224 Standard_EXPORT gp_Elips Ellipse (const Standard_Integer Num) const;
225
226 //! Returns the parabola solution of range Num.
227 Standard_EXPORT gp_Parab Parabola (const Standard_Integer Num) const;
228
229 //! Returns the hyperbola solution of range Num.
230 Standard_EXPORT gp_Hypr Hyperbola (const Standard_Integer Num) const;
231
232 Standard_EXPORT Standard_Boolean HasCommonGen() const;
233
234 Standard_EXPORT const gp_Pnt& PChar() const;
235
236
237
238
239protected:
240
241
242 //! Initialize the values of inner tolerances.
243 Standard_EXPORT void InitTolerances();
244
245
246 Standard_Boolean done;
247 Standard_Integer nbint;
248 IntAna_ResultType typeres;
249 gp_Pnt pt1;
250 gp_Pnt pt2;
251 gp_Pnt pt3;
252 gp_Pnt pt4;
253 gp_Dir dir1;
254 gp_Dir dir2;
255 gp_Dir dir3;
256 gp_Dir dir4;
257 Standard_Real param1;
258 Standard_Real param2;
259 Standard_Real param3;
260 Standard_Real param4;
261 Standard_Real param1bis;
262 Standard_Real param2bis;
263 Standard_Real myEPSILON_DISTANCE;
264 Standard_Real myEPSILON_ANGLE_CONE;
265 Standard_Real myEPSILON_MINI_CIRCLE_RADIUS;
266 Standard_Real myEPSILON_CYLINDER_DELTA_RADIUS;
267 Standard_Real myEPSILON_CYLINDER_DELTA_DISTANCE;
268 Standard_Real myEPSILON_AXES_PARA;
269 Standard_Boolean myCommonGen;
270 gp_Pnt myPChar;
271
272
273private:
274
275
276
277
278
279};
280
281
282#include <IntAna_QuadQuadGeo.lxx>
283
284
285
286
287
288#endif // _IntAna_QuadQuadGeo_HeaderFile