1 // Created on: 1993-12-02 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 _BlendFunc_ConstRad_HeaderFile 18 #define _BlendFunc_ConstRad_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 #include <gp_Pnt.hxx> 25 #include <Standard_Boolean.hxx> 26 #include <gp_Vec.hxx> 27 #include <gp_Vec2d.hxx> 28 #include <Standard_Real.hxx> 29 #include <Standard_Integer.hxx> 30 #include <math_Vector.hxx> 31 #include <math_Matrix.hxx> 32 #include <BlendFunc_Tensor.hxx> 33 #include <BlendFunc_SectionShape.hxx> 34 #include <Convert_ParameterisationType.hxx> 35 #include <Blend_Function.hxx> 36 #include <TColStd_Array1OfReal.hxx> 37 #include <GeomAbs_Shape.hxx> 38 #include <TColStd_Array1OfInteger.hxx> 39 #include <TColgp_Array1OfPnt.hxx> 40 #include <TColgp_Array1OfVec.hxx> 41 #include <TColgp_Array1OfPnt2d.hxx> 42 #include <TColgp_Array1OfVec2d.hxx> 43 class Adaptor3d_HSurface; 44 class Adaptor3d_HCurve; 45 class math_Matrix; 46 class gp_Pnt; 47 class gp_Vec; 48 class gp_Vec2d; 49 class gp_Circ; 50 class Blend_Point; 51 class gp_Ax1; 52 53 54 55 class BlendFunc_ConstRad : public Blend_Function 56 { 57 public: 58 59 DEFINE_STANDARD_ALLOC 60 61 62 Standard_EXPORT BlendFunc_ConstRad(const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_HCurve)& C); 63 64 //! returns the number of equations of the function. 65 Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE; 66 67 //! computes the values <F> of the Functions for the 68 //! variable <X>. 69 //! Returns True if the computation was done successfully, 70 //! False otherwise. 71 Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE; 72 73 //! returns the values <D> of the derivatives for the 74 //! variable <X>. 75 //! Returns True if the computation was done successfully, 76 //! False otherwise. 77 Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE; 78 79 //! returns the values <F> of the functions and the derivatives 80 //! <D> for the variable <X>. 81 //! Returns True if the computation was done successfully, 82 //! False otherwise. 83 Standard_EXPORT Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) Standard_OVERRIDE; 84 85 Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE; 86 87 Standard_EXPORT void Set (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE; 88 89 Standard_EXPORT void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const Standard_OVERRIDE; 90 91 Standard_EXPORT void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const Standard_OVERRIDE; 92 93 Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE; 94 95 //! Returns the minimal Distance beetween two 96 //! extremitys of calculed sections. 97 Standard_EXPORT Standard_Real GetMinimalDistance() const Standard_OVERRIDE; 98 99 Standard_EXPORT const gp_Pnt& PointOnS1() const Standard_OVERRIDE; 100 101 Standard_EXPORT const gp_Pnt& PointOnS2() const Standard_OVERRIDE; 102 103 Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE; 104 105 Standard_EXPORT const gp_Vec& TangentOnS1() const Standard_OVERRIDE; 106 107 Standard_EXPORT const gp_Vec2d& Tangent2dOnS1() const Standard_OVERRIDE; 108 109 Standard_EXPORT const gp_Vec& TangentOnS2() const Standard_OVERRIDE; 110 111 Standard_EXPORT const gp_Vec2d& Tangent2dOnS2() const Standard_OVERRIDE; 112 113 //! Returns the tangent vector at the section, 114 //! at the beginning and the end of the section, and 115 //! returns the normal (of the surfaces) at 116 //! these points. 117 Standard_EXPORT void Tangent (const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, gp_Vec& TgFirst, gp_Vec& TgLast, gp_Vec& NormFirst, gp_Vec& NormLast) const Standard_OVERRIDE; 118 119 Standard_EXPORT virtual Standard_Boolean TwistOnS1() const Standard_OVERRIDE; 120 121 Standard_EXPORT virtual Standard_Boolean TwistOnS2() const Standard_OVERRIDE; 122 123 //! Inits the value of radius, and the "quadrant". 124 Standard_EXPORT void Set (const Standard_Real Radius, const Standard_Integer Choix); 125 126 //! Sets the type of section generation for the 127 //! approximations. 128 Standard_EXPORT void Set (const BlendFunc_SectionShape TypeSection); 129 130 //! Utile pour une visu rapide et approximative de la surface. 131 Standard_EXPORT void Section (const Standard_Real Param, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, Standard_Real& Pdeb, Standard_Real& Pfin, gp_Circ& C); 132 133 //! Returns if the section is rationnal 134 Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; 135 136 //! Returns the length of the maximum section 137 Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE; 138 139 //! Compute the minimal value of weight for each poles 140 //! of all sections. 141 Standard_EXPORT void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE; 142 143 //! Returns the number of intervals for continuity 144 //! <S>. May be one if Continuity(me) >= <S> 145 Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE; 146 147 //! Stores in <T> the parameters bounding the intervals 148 //! of continuity <S>. 149 //! 150 //! The array must provide enough room to accomodate 151 //! for the parameters. i.e. T.Length() > NbIntervals() 152 Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE; 153 154 Standard_EXPORT void GetShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree, Standard_Integer& NbPoles2d) Standard_OVERRIDE; 155 156 //! Returns the tolerance to reach in approximation 157 //! to respecte 158 //! BoundTol error at the Boundary 159 //! AngleTol tangent error at the Boundary 160 //! SurfTol error inside the surface. 161 Standard_EXPORT void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, math_Vector& Tol3d, math_Vector& Tol1D) const Standard_OVERRIDE; 162 163 Standard_EXPORT void Knots (TColStd_Array1OfReal& TKnots) Standard_OVERRIDE; 164 165 Standard_EXPORT void Mults (TColStd_Array1OfInteger& TMults) Standard_OVERRIDE; 166 167 //! Used for the first and last section 168 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; 169 170 //! Used for the first and last section 171 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; 172 173 Standard_EXPORT void Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) Standard_OVERRIDE; 174 175 Standard_EXPORT gp_Ax1 AxeRot (const Standard_Real Prm); 176 177 Standard_EXPORT void Resolution (const Standard_Integer IC2d, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const Standard_OVERRIDE; 178 179 180 181 182 protected: 183 184 185 186 187 188 private: 189 190 191 Standard_EXPORT Standard_Boolean ComputeValues (const math_Vector& X, const Standard_Integer Order, const Standard_Boolean ByParam = Standard_False, const Standard_Real Param = 0); 192 193 194 Handle(Adaptor3d_HSurface) surf1; 195 Handle(Adaptor3d_HSurface) surf2; 196 Handle(Adaptor3d_HCurve) curv; 197 Handle(Adaptor3d_HCurve) tcurv; 198 gp_Pnt pts1; 199 gp_Pnt pts2; 200 Standard_Boolean istangent; 201 gp_Vec tg1; 202 gp_Vec2d tg12d; 203 gp_Vec tg2; 204 gp_Vec2d tg22d; 205 Standard_Real param; 206 Standard_Real ray1; 207 Standard_Real ray2; 208 Standard_Integer choix; 209 Standard_Integer myXOrder; 210 Standard_Integer myTOrder; 211 math_Vector xval; 212 Standard_Real tval; 213 gp_Vec d1u1; 214 gp_Vec d1u2; 215 gp_Vec d1v1; 216 gp_Vec d1v2; 217 gp_Vec d2u1; 218 gp_Vec d2v1; 219 gp_Vec d2uv1; 220 gp_Vec d2u2; 221 gp_Vec d2v2; 222 gp_Vec d2uv2; 223 gp_Vec dn1w; 224 gp_Vec dn2w; 225 gp_Vec d2n1w; 226 gp_Vec d2n2w; 227 gp_Vec nplan; 228 gp_Vec nsurf1; 229 gp_Vec dns1u1; 230 gp_Vec dns1u2; 231 gp_Vec dns1v1; 232 gp_Vec dns1v2; 233 gp_Vec nsurf2; 234 gp_Vec dnplan; 235 gp_Vec d2nplan; 236 gp_Vec dnsurf1; 237 gp_Vec dnsurf2; 238 gp_Vec dndu1; 239 gp_Vec dndu2; 240 gp_Vec dndv1; 241 gp_Vec dndv2; 242 gp_Vec d2ndu1; 243 gp_Vec d2ndu2; 244 gp_Vec d2ndv1; 245 gp_Vec d2ndv2; 246 gp_Vec d2nduv1; 247 gp_Vec d2nduv2; 248 gp_Vec d2ndtu1; 249 gp_Vec d2ndtu2; 250 gp_Vec d2ndtv1; 251 gp_Vec d2ndtv2; 252 math_Vector E; 253 math_Matrix DEDX; 254 math_Vector DEDT; 255 BlendFunc_Tensor D2EDX2; 256 math_Matrix D2EDXDT; 257 math_Vector D2EDT2; 258 Standard_Real maxang; 259 Standard_Real minang; 260 Standard_Real distmin; 261 BlendFunc_SectionShape mySShape; 262 Convert_ParameterisationType myTConv; 263 264 265 }; 266 267 268 269 270 271 272 273 #endif // _BlendFunc_ConstRad_HeaderFile 274