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