1 // Created by: Jacques GOUSSARD Author: Laurent BOURESCHE --
2 // Copyright (c) 1997-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _Blend_SurfRstFunction_HeaderFile
17 #define _Blend_SurfRstFunction_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
23 #include <Blend_AppFunction.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <math_Vector.hxx>
27 #include <Standard_Real.hxx>
28 #include <TColStd_Array1OfReal.hxx>
29 #include <GeomAbs_Shape.hxx>
30 #include <TColStd_Array1OfInteger.hxx>
31 #include <TColgp_Array1OfPnt.hxx>
32 #include <TColgp_Array1OfVec.hxx>
33 #include <TColgp_Array1OfPnt2d.hxx>
34 #include <TColgp_Array1OfVec2d.hxx>
35 class Standard_DomainError;
44 //! Deferred class for a function used to compute a blending
45 //! surface between a surface and a pcurve on an other Surface,
46 //! using a guide line.
47 //! The vector <X> used in Value, Values and Derivatives methods
48 //! may be the vector of the parametric coordinates U,V,
49 //! W of the extremities of a section on the surface and
51 class Blend_SurfRstFunction : public Blend_AppFunction
58 //! Returns 3 (default value). Can be redefined.
59 Standard_EXPORT virtual Standard_Integer NbVariables() const = 0;
61 //! returns the number of equations of the function.
62 Standard_EXPORT virtual Standard_Integer NbEquations() const = 0;
64 //! computes the values <F> of the Functions for the
66 //! Returns True if the computation was done successfully,
68 Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& X, math_Vector& F) = 0;
70 //! returns the values <D> of the derivatives for the
72 //! Returns True if the computation was done successfully,
74 Standard_EXPORT virtual Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) = 0;
76 //! returns the values <F> of the functions and the derivatives
77 //! <D> for the variable <X>.
78 //! Returns True if the computation was done successfully,
80 Standard_EXPORT virtual Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) = 0;
82 //! Sets the value of the parameter along the guide line.
83 //! This determines the plane in which the solution has
85 Standard_EXPORT virtual void Set (const Standard_Real Param) = 0;
87 //! Sets the bounds of the parametric interval on
89 //! This determines the derivatives in these values if the
90 //! function is not Cn.
91 Standard_EXPORT virtual void Set (const Standard_Real First, const Standard_Real Last) = 0;
93 //! Returns in the vector Tolerance the parametric tolerance
94 //! for each variable;
95 //! Tol is the tolerance used in 3d space.
96 Standard_EXPORT virtual void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const = 0;
98 //! Returns in the vector InfBound the lowest values allowed
99 //! for each variables.
100 //! Returns in the vector SupBound the greatest values allowed
101 //! for each of the 3 variables.
102 Standard_EXPORT virtual void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const = 0;
104 //! Returns Standard_True if Sol is a zero of the function.
105 //! Tol is the tolerance used in 3d space.
106 //! The computation is made at the current value of
107 //! the parameter on the guide line.
108 Standard_EXPORT virtual Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) = 0;
110 //! Returns the minimal Distance beetween two
111 //! extremitys of calculed sections.
112 Standard_EXPORT Standard_Real GetMinimalDistance() const;
114 //! Returns the point on the first support.
115 Standard_EXPORT const gp_Pnt& Pnt1() const;
117 //! Returns the point on the seconde support.
118 Standard_EXPORT const gp_Pnt& Pnt2() const;
120 //! Returns the point on the surface.
121 Standard_EXPORT virtual const gp_Pnt& PointOnS() const = 0;
123 //! Returns the point on the curve.
124 Standard_EXPORT virtual const gp_Pnt& PointOnRst() const = 0;
126 //! Returns U,V coordinates of the point on the surface.
127 Standard_EXPORT virtual const gp_Pnt2d& Pnt2dOnS() const = 0;
129 //! Returns U,V coordinates of the point on the curve on
131 Standard_EXPORT virtual const gp_Pnt2d& Pnt2dOnRst() const = 0;
133 //! Returns parameter of the point on the curve.
134 Standard_EXPORT virtual Standard_Real ParameterOnRst() const = 0;
136 //! Returns True when it is not possible to compute
137 //! the tangent vectors at PointOnS and/or PointOnRst.
138 Standard_EXPORT virtual Standard_Boolean IsTangencyPoint() const = 0;
140 //! Returns the tangent vector at PointOnS, in 3d space.
141 Standard_EXPORT virtual const gp_Vec& TangentOnS() const = 0;
143 //! Returns the tangent vector at PointOnS, in the
144 //! parametric space of the first surface.
145 Standard_EXPORT virtual const gp_Vec2d& Tangent2dOnS() const = 0;
147 //! Returns the tangent vector at PointOnC, in 3d space.
148 Standard_EXPORT virtual const gp_Vec& TangentOnRst() const = 0;
150 //! Returns the tangent vector at PointOnRst, in the
151 //! parametric space of the second surface.
152 Standard_EXPORT virtual const gp_Vec2d& Tangent2dOnRst() const = 0;
154 //! Enables implementation of a criterion of decrochage
155 //! specific to the function.
156 Standard_EXPORT virtual Standard_Boolean Decroch (const math_Vector& Sol, gp_Vec& NS, gp_Vec& TgS) const = 0;
158 //! Returns if the section is rationnal
159 Standard_EXPORT virtual Standard_Boolean IsRational() const = 0;
161 //! Returns the length of the maximum section
162 Standard_EXPORT virtual Standard_Real GetSectionSize() const = 0;
164 //! Compute the minimal value of weight for each poles
166 Standard_EXPORT virtual void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const = 0;
168 //! Returns the number of intervals for continuity
169 //! <S>. May be one if Continuity(me) >= <S>
170 Standard_EXPORT virtual Standard_Integer NbIntervals (const GeomAbs_Shape S) const = 0;
172 //! Stores in <T> the parameters bounding the intervals
173 //! of continuity <S>.
175 //! The array must provide enough room to accomodate
176 //! for the parameters. i.e. T.Length() > NbIntervals()
177 Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const = 0;
179 Standard_EXPORT virtual void GetShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree, Standard_Integer& NbPoles2d) = 0;
181 //! Returns the tolerance to reach in approximation
183 //! BoundTol error at the Boundary
184 //! AngleTol tangent error at the Boundary
185 //! SurfTol error inside the surface.
186 Standard_EXPORT virtual void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, math_Vector& Tol3d, math_Vector& Tol1D) const = 0;
188 Standard_EXPORT virtual void Knots (TColStd_Array1OfReal& TKnots) = 0;
190 Standard_EXPORT virtual void Mults (TColStd_Array1OfInteger& TMults) = 0;
192 //! Used for the first and last section
193 //! The method returns Standard_True if the derivatives
194 //! are computed, otherwise it returns Standard_False.
195 Standard_EXPORT virtual Standard_Boolean Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths) = 0;
197 //! Used for the first and last section
198 //! The method returns Standard_True if the derivatives
199 //! are computed, otherwise it returns Standard_False.
200 Standard_EXPORT virtual Standard_Boolean Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfVec& D2Poles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColgp_Array1OfVec2d& D2Poles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths, TColStd_Array1OfReal& D2Weigths) = 0;
202 Standard_EXPORT virtual void Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) = 0;
227 #endif // _Blend_SurfRstFunction_HeaderFile