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 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 _Blend_AppFunction_HeaderFile 18 #define _Blend_AppFunction_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 #include <math_FunctionSetWithDerivatives.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 <GeomAbs_Shape.hxx> 31 #include <TColStd_Array1OfInteger.hxx> 32 #include <TColgp_Array1OfPnt.hxx> 33 #include <TColgp_Array1OfVec.hxx> 34 #include <TColgp_Array1OfPnt2d.hxx> 35 #include <TColgp_Array1OfVec2d.hxx> 36 class Standard_DomainError; 37 class math_Matrix; 38 class gp_Pnt; 39 class Blend_Point; 40 41 42 //! Deferred class for a function used to compute a blending 43 //! surface between two surfaces, using a guide line. 44 //! The vector <X> used in Value, Values and Derivatives methods 45 //! has to be the vector of the parametric coordinates U1,V1, 46 //! U2,V2, of the extremities of a section on the first and 47 //! second surface. 48 class Blend_AppFunction : public math_FunctionSetWithDerivatives 49 { 50 public: 51 52 DEFINE_STANDARD_ALLOC 53 54 55 //! returns the number of variables of the function. 56 Standard_EXPORT virtual Standard_Integer NbVariables() const = 0; 57 58 //! returns the number of equations of the function. 59 Standard_EXPORT virtual Standard_Integer NbEquations() const = 0; 60 61 //! computes the values <F> of the Functions for the 62 //! variable <X>. 63 //! Returns True if the computation was done successfully, 64 //! False otherwise. 65 Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& X, math_Vector& F) = 0; 66 67 //! returns the values <D> of the derivatives for the 68 //! variable <X>. 69 //! Returns True if the computation was done successfully, 70 //! False otherwise. 71 Standard_EXPORT virtual Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) = 0; 72 73 //! returns the values <F> of the functions and the derivatives 74 //! <D> for the variable <X>. 75 //! Returns True if the computation was done successfully, 76 //! False otherwise. 77 Standard_EXPORT virtual Standard_Boolean Values (const math_Vector& X, 78 math_Vector& F, 79 math_Matrix& D) = 0; 80 81 //! Sets the value of the parameter along the guide line. 82 //! This determines the plane in which the solution has 83 //! to be found. 84 Standard_EXPORT virtual void Set (const Standard_Real Param) = 0; 85 86 //! Sets the bounds of the parametric interval on 87 //! the guide line. 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) = 0; 91 92 //! Returns in the vector Tolerance the parametric tolerance 93 //! for each of the 4 variables; 94 //! Tol is the tolerance used in 3d space. 95 Standard_EXPORT virtual void GetTolerance (math_Vector& Tolerance, 96 const Standard_Real Tol) const = 0; 97 98 //! Returns in the vector InfBound the lowest values allowed 99 //! for each of the 4 variables. 100 //! Returns in the vector SupBound the greatest values allowed 101 //! for each of the 4 variables. 102 Standard_EXPORT virtual void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const = 0; 103 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, 109 const Standard_Real Tol) = 0; 110 111 //! Returns the minimal Distance beetween two 112 //! extremitys of calculed sections. 113 Standard_EXPORT virtual Standard_Real GetMinimalDistance() const = 0; 114 115 //! Returns the point on the first support. 116 Standard_EXPORT virtual const gp_Pnt& Pnt1() const = 0; 117 118 //! Returns the point on the first support. 119 Standard_EXPORT virtual const gp_Pnt& Pnt2() const = 0; 120 121 //! Returns if the section is rationnal 122 Standard_EXPORT virtual Standard_Boolean IsRational() const = 0; 123 124 //! Returns the length of the maximum section 125 Standard_EXPORT virtual Standard_Real GetSectionSize() const = 0; 126 127 //! Compute the minimal value of weight for each poles 128 //! of all sections. 129 Standard_EXPORT virtual void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const = 0; 130 131 //! Returns the number of intervals for continuity 132 //! <S>. May be one if Continuity(me) >= <S> 133 Standard_EXPORT virtual Standard_Integer NbIntervals (const GeomAbs_Shape S) const = 0; 134 135 //! Stores in <T> the parameters bounding the intervals 136 //! of continuity <S>. 137 //! 138 //! The array must provide enough room to accomodate 139 //! for the parameters. i.e. T.Length() > NbIntervals() 140 //! raises 141 //! OutOfRange from Standard 142 Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, 143 const GeomAbs_Shape S) const = 0; 144 145 Standard_EXPORT virtual void GetShape (Standard_Integer& NbPoles, 146 Standard_Integer& NbKnots, 147 Standard_Integer& Degree, 148 Standard_Integer& NbPoles2d) = 0; 149 150 //! Returns the tolerance to reach in approximation 151 //! to respecte 152 //! BoundTol error at the Boundary 153 //! AngleTol tangent error at the Boundary 154 //! SurfTol error inside the surface. 155 Standard_EXPORT virtual void GetTolerance (const Standard_Real BoundTol, 156 const Standard_Real SurfTol, 157 const Standard_Real AngleTol, 158 math_Vector& Tol3d, 159 math_Vector& Tol1D) const = 0; 160 161 Standard_EXPORT virtual void Knots (TColStd_Array1OfReal& TKnots) = 0; 162 163 Standard_EXPORT virtual void Mults (TColStd_Array1OfInteger& TMults) = 0; 164 165 //! Used for the first and last section 166 //! The method returns Standard_True if the derivatives 167 //! are computed, otherwise it returns Standard_False. 168 Standard_EXPORT virtual Standard_Boolean Section (const Blend_Point& P, 169 TColgp_Array1OfPnt& Poles, 170 TColgp_Array1OfVec& DPoles, 171 TColgp_Array1OfPnt2d& Poles2d, 172 TColgp_Array1OfVec2d& DPoles2d, 173 TColStd_Array1OfReal& Weigths, 174 TColStd_Array1OfReal& DWeigths) = 0; 175 176 Standard_EXPORT virtual void Section (const Blend_Point& P, 177 TColgp_Array1OfPnt& Poles, 178 TColgp_Array1OfPnt2d& Poles2d, 179 TColStd_Array1OfReal& Weigths) = 0; 180 181 //! Used for the first and last section 182 //! The method returns Standard_True if the derivatives 183 //! are computed, otherwise it returns Standard_False. 184 Standard_EXPORT virtual Standard_Boolean Section (const Blend_Point& P, 185 TColgp_Array1OfPnt& Poles, 186 TColgp_Array1OfVec& DPoles, 187 TColgp_Array1OfVec& D2Poles, 188 TColgp_Array1OfPnt2d& Poles2d, 189 TColgp_Array1OfVec2d& DPoles2d, 190 TColgp_Array1OfVec2d& D2Poles2d, 191 TColStd_Array1OfReal& Weigths, 192 TColStd_Array1OfReal& DWeigths, 193 TColStd_Array1OfReal& D2Weigths) = 0; 194 195 Standard_EXPORT virtual void Resolution (const Standard_Integer IC2d, 196 const Standard_Real Tol, 197 Standard_Real& TolU, 198 Standard_Real& TolV) const = 0; 199 200 //! Returns the parameter of the point P. Used to 201 //! impose the parameters in the approximation. 202 Standard_EXPORT Standard_Real Parameter (const Blend_Point& P) const; 203 204 205 206 207 protected: 208 209 210 211 212 213 private: 214 215 216 217 218 219 }; 220 221 222 223 224 225 226 227 #endif // _Blend_AppFunction_HeaderFile 228