1 // Created on: 1993-09-13
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Blend_CSFunction_HeaderFile
18 #define _Blend_CSFunction_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Blend_AppFunction.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <math_Vector.hxx>
28 #include <Standard_Real.hxx>
29 #include <TColStd_Array1OfReal.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 curve, using a guide line.
46 //! The vector <X> used in Value, Values and Derivatives methods
47 //! may be the vector of the parametric coordinates U,V,
48 //! W of the extremities of a section on the surface and
50 class Blend_CSFunction : public Blend_AppFunction
57 //! Returns 3 (default value). Can be redefined.
58 Standard_EXPORT virtual Standard_Integer NbVariables() const Standard_OVERRIDE;
60 //! returns the number of equations of the function.
61 Standard_EXPORT virtual Standard_Integer NbEquations() const Standard_OVERRIDE = 0;
63 //! computes the values <F> of the Functions for the
65 //! Returns True if the computation was done successfully,
67 Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE = 0;
69 //! returns the values <D> of the derivatives for the
71 //! Returns True if the computation was done successfully,
73 Standard_EXPORT virtual Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE = 0;
75 //! returns the values <F> of the functions and the derivatives
76 //! <D> for the variable <X>.
77 //! Returns True if the computation was done successfully,
79 Standard_EXPORT virtual Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) Standard_OVERRIDE = 0;
81 //! Sets the value of the parameter along the guide line.
82 //! This determines the plane in which the solution has
84 Standard_EXPORT virtual void Set (const Standard_Real Param) Standard_OVERRIDE = 0;
86 //! Sets the bounds of the parametric interval on
88 //! This determines the derivatives in these values if the
89 //! function is not Cn.
90 Standard_EXPORT virtual void Set (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE = 0;
92 //! Returns in the vector Tolerance the parametric tolerance
93 //! for each of the 3 variables;
94 //! Tol is the tolerance used in 3d space.
95 Standard_EXPORT virtual void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const Standard_OVERRIDE = 0;
97 //! Returns in the vector InfBound the lowest values allowed
98 //! for each of the 3 variables.
99 //! Returns in the vector SupBound the greatest values allowed
100 //! for each of the 3 variables.
101 Standard_EXPORT virtual void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const Standard_OVERRIDE = 0;
103 //! Returns Standard_True if Sol is a zero of the function.
104 //! Tol is the tolerance used in 3d space.
105 //! The computation is made at the current value of
106 //! the parameter on the guide line.
107 Standard_EXPORT virtual Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE = 0;
109 //! Returns the minimal Distance beetween two
110 //! extremitys of calculed sections.
111 Standard_EXPORT virtual Standard_Real GetMinimalDistance() const Standard_OVERRIDE;
113 //! Returns the point on the first support.
114 Standard_EXPORT const gp_Pnt& Pnt1() const Standard_OVERRIDE;
116 //! Returns the point on the seconde support.
117 Standard_EXPORT const gp_Pnt& Pnt2() const Standard_OVERRIDE;
119 //! Returns the point on the surface.
120 Standard_EXPORT virtual const gp_Pnt& PointOnS() const = 0;
122 //! Returns the point on the curve.
123 Standard_EXPORT virtual const gp_Pnt& PointOnC() const = 0;
125 //! Returns U,V coordinates of the point on the surface.
126 Standard_EXPORT virtual const gp_Pnt2d& Pnt2d() const = 0;
128 //! Returns parameter of the point on the curve.
129 Standard_EXPORT virtual Standard_Real ParameterOnC() const = 0;
131 //! Returns True when it is not possible to compute
132 //! the tangent vectors at PointOnS and/or PointOnC.
133 Standard_EXPORT virtual Standard_Boolean IsTangencyPoint() const = 0;
135 //! Returns the tangent vector at PointOnS, in 3d space.
136 Standard_EXPORT virtual const gp_Vec& TangentOnS() const = 0;
138 //! Returns the tangent vector at PointOnS, in the
139 //! parametric space of the first surface.
140 Standard_EXPORT virtual const gp_Vec2d& Tangent2d() const = 0;
142 //! Returns the tangent vector at PointOnC, in 3d space.
143 Standard_EXPORT virtual const gp_Vec& TangentOnC() const = 0;
145 //! Returns the tangent vector at the section,
146 //! at the beginning and the end of the section, and
147 //! returns the normal (of the surfaces) at
149 Standard_EXPORT virtual void Tangent (const Standard_Real U, const Standard_Real V, gp_Vec& TgS, gp_Vec& NormS) const = 0;
151 Standard_EXPORT virtual void GetShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree, Standard_Integer& NbPoles2d) Standard_OVERRIDE = 0;
153 //! Returns the tolerance to reach in approximation
155 //! BoundTol error at the Boundary
156 //! AngleTol tangent error at the Boundary
157 //! SurfTol error inside the surface.
158 Standard_EXPORT virtual void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, math_Vector& Tol3d, math_Vector& Tol1D) const Standard_OVERRIDE = 0;
160 Standard_EXPORT virtual void Knots (TColStd_Array1OfReal& TKnots) Standard_OVERRIDE = 0;
162 Standard_EXPORT virtual void Mults (TColStd_Array1OfInteger& TMults) Standard_OVERRIDE = 0;
164 //! Used for the first and last section
165 //! The method returns Standard_True if the derivatives
166 //! are computed, otherwise it returns Standard_False.
167 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) Standard_OVERRIDE = 0;
169 Standard_EXPORT virtual void Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) Standard_OVERRIDE = 0;
171 //! Used for the first and last section
172 //! The method returns Standard_True if the derivatives
173 //! are computed, otherwise it returns Standard_False.
174 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) Standard_OVERRIDE;
199 #endif // _Blend_CSFunction_HeaderFile