0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / IntAna / IntAna_Curve.hxx
1 // Created on: 1992-06-30
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_Curve_HeaderFile
18 #define _IntAna_Curve_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <GeomAbs_SurfaceType.hxx>
25 #include <gp_Ax3.hxx>
26 #include <TColStd_ListOfReal.hxx>
27
28 //! Definition of a parametric Curve which is the result
29 //! of the intersection between two quadrics.
30 class IntAna_Curve 
31 {
32 public:
33
34   DEFINE_STANDARD_ALLOC
35
36   
37   //! Empty Constructor
38   Standard_EXPORT IntAna_Curve();
39   
40   //! Sets the parameters used to compute Points and Derivative
41   //! on the curve.
42   Standard_EXPORT void SetCylinderQuadValues (const gp_Cylinder& Cylinder, const Standard_Real Qxx, const Standard_Real Qyy, const Standard_Real Qzz, const Standard_Real Qxy, const Standard_Real Qxz, const Standard_Real Qyz, const Standard_Real Qx, const Standard_Real Qy, const Standard_Real Qz, const Standard_Real Q1, const Standard_Real Tol, const Standard_Real DomInf, const Standard_Real DomSup, const Standard_Boolean TwoZForATheta, const Standard_Boolean ZIsPositive);
43   
44   //! Sets  the parameters used    to compute Points  and
45   //! Derivative on the curve.
46   Standard_EXPORT void SetConeQuadValues (const gp_Cone& Cone, const Standard_Real Qxx, const Standard_Real Qyy, const Standard_Real Qzz, const Standard_Real Qxy, const Standard_Real Qxz, const Standard_Real Qyz, const Standard_Real Qx, const Standard_Real Qy, const Standard_Real Qz, const Standard_Real Q1, const Standard_Real Tol, const Standard_Real DomInf, const Standard_Real DomSup, const Standard_Boolean TwoZForATheta, const Standard_Boolean ZIsPositive);
47   
48   //! Returns TRUE if the curve is not  infinite  at the
49   //! last parameter or at the first parameter of the domain.
50   Standard_EXPORT Standard_Boolean IsOpen() const;
51   
52   //! Returns the paramatric domain of the curve.
53   Standard_EXPORT void Domain(Standard_Real& theFirst, Standard_Real& theLast) const;
54   
55   //! Returns TRUE if the function is constant.
56   Standard_EXPORT Standard_Boolean IsConstant() const;
57   
58   //! Returns TRUE if the domain is open at the beginning.
59   Standard_EXPORT Standard_Boolean IsFirstOpen() const;
60   
61   //! Returns TRUE if the domain is open at the end.
62   Standard_EXPORT Standard_Boolean IsLastOpen() const;
63   
64   //! Returns the point at parameter Theta on the curve.
65   Standard_EXPORT gp_Pnt Value (const Standard_Real Theta);
66   
67   //! Returns the point and the first derivative at parameter
68   //! Theta on the curve.
69   Standard_EXPORT Standard_Boolean D1u (const Standard_Real Theta, gp_Pnt& P, gp_Vec& V);
70   
71   //! Tries to find the parameter of the point P on the curve.
72   //! If the method returns False, the "projection" is
73   //! impossible.
74   //! If the method returns True at least one parameter has been found.
75   //! theParams is always sorted in ascending order.
76   Standard_EXPORT void FindParameter(const gp_Pnt& P,
77                                      TColStd_ListOfReal& theParams) const;
78   
79   //! If flag is True, the Curve is not defined at the
80   //! first parameter of its domain.
81   Standard_EXPORT void SetIsFirstOpen (const Standard_Boolean Flag);
82   
83   //! If flag is True, the Curve is not defined at the
84   //! first parameter of its domain.
85   Standard_EXPORT void SetIsLastOpen (const Standard_Boolean Flag);
86   
87   //! Trims this curve
88   Standard_EXPORT void SetDomain(const Standard_Real theFirst, const Standard_Real theLast);
89
90
91
92
93 protected:
94
95   
96   //! Protected function.
97   Standard_EXPORT gp_Pnt InternalValue (const Standard_Real Theta1, const Standard_Real Theta2) const;
98
99   //! Protected function.
100   Standard_EXPORT void InternalUVValue (const Standard_Real Param, Standard_Real& U, Standard_Real& V, Standard_Real& A, Standard_Real& B, Standard_Real& C, Standard_Real& Co, Standard_Real& Si, Standard_Real& Di) const;
101
102
103
104 private:
105
106
107
108   Standard_Real Z0Cte;
109   Standard_Real Z0Sin;
110   Standard_Real Z0Cos;
111   Standard_Real Z0SinSin;
112   Standard_Real Z0CosCos;
113   Standard_Real Z0CosSin;
114   Standard_Real Z1Cte;
115   Standard_Real Z1Sin;
116   Standard_Real Z1Cos;
117   Standard_Real Z1SinSin;
118   Standard_Real Z1CosCos;
119   Standard_Real Z1CosSin;
120   Standard_Real Z2Cte;
121   Standard_Real Z2Sin;
122   Standard_Real Z2Cos;
123   Standard_Real Z2SinSin;
124   Standard_Real Z2CosCos;
125   Standard_Real Z2CosSin;
126   Standard_Boolean TwoCurves;
127   Standard_Boolean TakeZPositive;
128   Standard_Real Tolerance;
129
130   //! Internal fields defining the default domain
131   Standard_Real DomainInf, DomainSup;
132   Standard_Boolean RestrictedInf;
133   Standard_Boolean RestrictedSup;
134   Standard_Boolean firstbounded;
135   Standard_Boolean lastbounded;
136   GeomAbs_SurfaceType typequadric;
137   Standard_Real RCyl;
138   Standard_Real Angle;
139   gp_Ax3 Ax3;
140
141   //! Trim boundaries
142   Standard_Real myFirstParameter, myLastParameter;
143
144
145 };
146
147
148
149
150
151
152
153 #endif // _IntAna_Curve_HeaderFile