1 // Created on: 1997-07-28 2 // Created by: Jerome LEMONIER 3 // Copyright (c) 1997-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 _BRepBlend_SurfRstEvolRad_HeaderFile 18 #define _BRepBlend_SurfRstEvolRad_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 #include <Adaptor3d_CurveOnSurface.hxx> 25 #include <gp_Pnt.hxx> 26 #include <gp_Pnt2d.hxx> 27 #include <Standard_Real.hxx> 28 #include <Standard_Boolean.hxx> 29 #include <gp_Vec.hxx> 30 #include <gp_Vec2d.hxx> 31 #include <Standard_Integer.hxx> 32 #include <BlendFunc_SectionShape.hxx> 33 #include <Convert_ParameterisationType.hxx> 34 #include <Blend_SurfRstFunction.hxx> 35 #include <math_Vector.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 Adaptor2d_HCurve2d; 45 class Adaptor3d_HCurve; 46 class Law_Function; 47 class math_Matrix; 48 class gp_Pnt; 49 class gp_Pnt2d; 50 class gp_Vec; 51 class gp_Vec2d; 52 class gp_Circ; 53 class Blend_Point; 54 55 56 //! Function to approximate by AppSurface for 57 //! Edge/Face and evolutif radius 58 class BRepBlend_SurfRstEvolRad : public Blend_SurfRstFunction 59 { 60 public: 61 62 DEFINE_STANDARD_ALLOC 63 64 65 Standard_EXPORT BRepBlend_SurfRstEvolRad(const Handle(Adaptor3d_HSurface)& Surf, const Handle(Adaptor3d_HSurface)& SurfRst, const Handle(Adaptor2d_HCurve2d)& Rst, const Handle(Adaptor3d_HCurve)& CGuide, const Handle(Law_Function)& Evol); 66 67 //! Returns 3. 68 Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE; 69 70 //! Returns 3. 71 Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE; 72 73 //! computes the values <F> of the Functions for the 74 //! variable <X>. 75 //! Returns True if the computation was done successfully, 76 //! False otherwise. 77 Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE; 78 79 //! returns the values <D> of the derivatives for the 80 //! variable <X>. 81 //! Returns True if the computation was done successfully, 82 //! False otherwise. 83 Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE; 84 85 //! returns the values <F> of the functions and the derivatives 86 //! <D> for the variable <X>. 87 //! Returns True if the computation was done successfully, 88 //! False otherwise. 89 Standard_EXPORT Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) Standard_OVERRIDE; 90 91 Standard_EXPORT void Set (const Handle(Adaptor3d_HSurface)& SurfRef, const Handle(Adaptor2d_HCurve2d)& RstRef); 92 93 Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE; 94 95 //! Sets the bounds of the parametric interval on 96 //! the guide line. 97 //! This determines the derivatives in these values if the 98 //! function is not Cn. 99 Standard_EXPORT void Set (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE; 100 101 Standard_EXPORT void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const Standard_OVERRIDE; 102 103 Standard_EXPORT void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const Standard_OVERRIDE; 104 105 Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE; 106 107 //! Returns the minimal Distance beetween two 108 //! extremitys of calculed sections. 109 Standard_EXPORT virtual Standard_Real GetMinimalDistance() const Standard_OVERRIDE; 110 111 Standard_EXPORT const gp_Pnt& PointOnS() const Standard_OVERRIDE; 112 113 Standard_EXPORT const gp_Pnt& PointOnRst() const Standard_OVERRIDE; 114 115 //! Returns U,V coordinates of the point on the surface. 116 Standard_EXPORT const gp_Pnt2d& Pnt2dOnS() const Standard_OVERRIDE; 117 118 //! Returns U,V coordinates of the point on the curve on 119 //! surface. 120 Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst() const Standard_OVERRIDE; 121 122 //! Returns parameter of the point on the curve. 123 Standard_EXPORT Standard_Real ParameterOnRst() const Standard_OVERRIDE; 124 125 Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE; 126 127 Standard_EXPORT const gp_Vec& TangentOnS() const Standard_OVERRIDE; 128 129 Standard_EXPORT const gp_Vec2d& Tangent2dOnS() const Standard_OVERRIDE; 130 131 Standard_EXPORT const gp_Vec& TangentOnRst() const Standard_OVERRIDE; 132 133 Standard_EXPORT const gp_Vec2d& Tangent2dOnRst() const Standard_OVERRIDE; 134 135 //! Permet d ' implementer un critere de decrochage 136 //! specifique a la fonction. 137 Standard_EXPORT Standard_Boolean Decroch (const math_Vector& Sol, gp_Vec& NS, gp_Vec& TgS) const Standard_OVERRIDE; 138 139 Standard_EXPORT void Set (const Standard_Integer Choix); 140 141 //! Sets the type of section generation for the 142 //! approximations. 143 Standard_EXPORT void Set (const BlendFunc_SectionShape TypeSection); 144 145 Standard_EXPORT void Section (const Standard_Real Param, const Standard_Real U, const Standard_Real V, const Standard_Real W, Standard_Real& Pdeb, Standard_Real& Pfin, gp_Circ& C); 146 147 //! Returns if the section is rationnal 148 Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; 149 150 //! Returns the length of the maximum section 151 Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE; 152 153 //! Compute the minimal value of weight for each poles 154 //! of all sections. 155 Standard_EXPORT void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE; 156 157 //! Returns the number of intervals for continuity 158 //! <S>. May be one if Continuity(me) >= <S> 159 Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE; 160 161 //! Stores in <T> the parameters bounding the intervals 162 //! of continuity <S>. 163 //! The array must provide enough room to accomodate 164 //! for the parameters. i.e. T.Length() > NbIntervals() 165 Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE; 166 167 Standard_EXPORT void GetShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree, Standard_Integer& NbPoles2d) Standard_OVERRIDE; 168 169 //! Returns the tolerance to reach in approximation 170 //! to respecte 171 //! BoundTol error at the Boundary 172 //! AngleTol tangent error at the Boundary 173 //! SurfTol error inside the surface. 174 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; 175 176 Standard_EXPORT void Knots (TColStd_Array1OfReal& TKnots) Standard_OVERRIDE; 177 178 Standard_EXPORT void Mults (TColStd_Array1OfInteger& TMults) Standard_OVERRIDE; 179 180 //! Used for the first and last section 181 Standard_EXPORT 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; 182 183 //! Used for the first and last section 184 //! The method returns Standard_True if the derivatives 185 //! are computed, otherwise it returns Standard_False. 186 Standard_EXPORT 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; 187 188 Standard_EXPORT void Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) Standard_OVERRIDE; 189 190 Standard_EXPORT void Resolution (const Standard_Integer IC2d, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const Standard_OVERRIDE; 191 192 193 194 195 protected: 196 197 198 199 200 201 private: 202 203 204 205 Handle(Adaptor3d_HSurface) surf; 206 Handle(Adaptor3d_HSurface) surfrst; 207 Handle(Adaptor2d_HCurve2d) rst; 208 Adaptor3d_CurveOnSurface cons; 209 Handle(Adaptor3d_HCurve) guide; 210 Handle(Adaptor3d_HCurve) tguide; 211 gp_Pnt pts; 212 gp_Pnt ptrst; 213 gp_Pnt2d pt2ds; 214 gp_Pnt2d pt2drst; 215 Standard_Real prmrst; 216 Standard_Boolean istangent; 217 gp_Vec tgs; 218 gp_Vec2d tg2ds; 219 gp_Vec tgrst; 220 gp_Vec2d tg2drst; 221 Standard_Real ray; 222 Standard_Real dray; 223 Standard_Integer choix; 224 gp_Pnt ptgui; 225 gp_Vec d1gui; 226 gp_Vec d2gui; 227 gp_Vec nplan; 228 Standard_Real normtg; 229 Standard_Real theD; 230 Handle(Adaptor3d_HSurface) surfref; 231 Handle(Adaptor2d_HCurve2d) rstref; 232 Standard_Real maxang; 233 Standard_Real minang; 234 Standard_Real distmin; 235 BlendFunc_SectionShape mySShape; 236 Convert_ParameterisationType myTConv; 237 Handle(Law_Function) tevol; 238 Handle(Law_Function) fevol; 239 Standard_Real sg1; 240 241 242 }; 243 244 245 246 247 248 249 250 #endif // _BRepBlend_SurfRstEvolRad_HeaderFile 251