1 // Created on: 1995-01-04 2 // Created by: Jacques GOUSSARD 3 // Copyright (c) 1995-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_CSCircular_HeaderFile 18 #define _BlendFunc_CSCircular_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 #include <gp_Pnt.hxx> 25 #include <gp_Pnt2d.hxx> 26 #include <Standard_Real.hxx> 27 #include <Standard_Boolean.hxx> 28 #include <gp_Vec.hxx> 29 #include <gp_Vec2d.hxx> 30 #include <Standard_Integer.hxx> 31 #include <BlendFunc_SectionShape.hxx> 32 #include <Convert_ParameterisationType.hxx> 33 #include <Blend_CSFunction.hxx> 34 #include <math_Vector.hxx> 35 #include <TColgp_Array1OfPnt.hxx> 36 #include <TColgp_Array1OfVec.hxx> 37 #include <TColgp_Array1OfPnt2d.hxx> 38 #include <TColgp_Array1OfVec2d.hxx> 39 #include <TColStd_Array1OfReal.hxx> 40 #include <GeomAbs_Shape.hxx> 41 #include <TColStd_Array1OfInteger.hxx> 42 class Adaptor3d_HSurface; 43 class Adaptor3d_HCurve; 44 class Law_Function; 45 class math_Matrix; 46 class gp_Pnt; 47 class gp_Pnt2d; 48 class gp_Vec; 49 class gp_Vec2d; 50 class gp_Circ; 51 class Blend_Point; 52 53 54 55 class BlendFunc_CSCircular : public Blend_CSFunction 56 { 57 public: 58 59 DEFINE_STANDARD_ALLOC 60 61 62 //! Creates a function for a circular blending between 63 //! a curve <C> and a surface <S>. The direction of 64 //! the planes are given by <CGuide>. The position of 65 //! the plane is determined on the curve <C>. <L> 66 //! defines the change of parameter between <C> and 67 //! <CGuide>. So, the planes are defined as described 68 //! below : 69 //! t is the current parameter on the guide line. 70 //! Pguide = C(L(t)); Nguide = CGuide'(t)/||CGuide'(t)|| 71 Standard_EXPORT BlendFunc_CSCircular(const Handle(Adaptor3d_HSurface)& S, const Handle(Adaptor3d_HCurve)& C, const Handle(Adaptor3d_HCurve)& CGuide, const Handle(Law_Function)& L); 72 73 Standard_EXPORT virtual Standard_Integer NbVariables() const Standard_OVERRIDE; 74 75 //! returns the number of equations of the function (3). 76 Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE; 77 78 //! computes the values <F> of the Functions for the 79 //! variable <X>. 80 //! Returns True if the computation was done successfully, 81 //! False otherwise. 82 Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE; 83 84 //! returns the values <D> of the derivatives for the 85 //! variable <X>. 86 //! Returns True if the computation was done successfully, 87 //! False otherwise. 88 Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE; 89 90 //! returns the values <F> of the functions and the derivatives 91 //! <D> for the variable <X>. 92 //! Returns True if the computation was done successfully, 93 //! False otherwise. 94 Standard_EXPORT Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) Standard_OVERRIDE; 95 96 Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE; 97 98 Standard_EXPORT void Set (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE; 99 100 Standard_EXPORT void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const Standard_OVERRIDE; 101 102 Standard_EXPORT void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const Standard_OVERRIDE; 103 104 Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE; 105 106 Standard_EXPORT const gp_Pnt& PointOnS() const Standard_OVERRIDE; 107 108 Standard_EXPORT const gp_Pnt& PointOnC() const Standard_OVERRIDE; 109 110 //! Returns U,V coordinates of the point on the surface. 111 Standard_EXPORT const gp_Pnt2d& Pnt2d() const Standard_OVERRIDE; 112 113 //! Returns parameter of the point on the curve. 114 Standard_EXPORT Standard_Real ParameterOnC() const Standard_OVERRIDE; 115 116 Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE; 117 118 Standard_EXPORT const gp_Vec& TangentOnS() const Standard_OVERRIDE; 119 120 Standard_EXPORT const gp_Vec2d& Tangent2d() const Standard_OVERRIDE; 121 122 Standard_EXPORT const gp_Vec& TangentOnC() const Standard_OVERRIDE; 123 124 //! Returns the tangent vector at the section, 125 //! at the beginning and the end of the section, and 126 //! returns the normal (of the surface) at 127 //! these points. 128 Standard_EXPORT void Tangent (const Standard_Real U, const Standard_Real V, gp_Vec& TgS, gp_Vec& NormS) const Standard_OVERRIDE; 129 130 Standard_EXPORT void Set (const Standard_Real Radius, const Standard_Integer Choix); 131 132 //! Sets the type of section generation for the 133 //! approximations. 134 Standard_EXPORT void Set (const BlendFunc_SectionShape TypeSection); 135 136 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); 137 138 //! Used for the first and last section 139 //! The method returns Standard_True if the derivatives 140 //! are computed, otherwise it returns Standard_False. 141 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; 142 143 Standard_EXPORT Standard_Boolean GetSection (const Standard_Real Param, const Standard_Real U, const Standard_Real V, const Standard_Real W, TColgp_Array1OfPnt& tabP, TColgp_Array1OfVec& tabV); 144 145 //! Returns if the section is rationnal 146 Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; 147 148 //! Returns the length of the maximum section 149 Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE; 150 151 //! Compute the minimal value of weight for each poles 152 //! of all sections. 153 Standard_EXPORT void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE; 154 155 //! Returns the number of intervals for continuity 156 //! <S>. May be one if Continuity(me) >= <S> 157 Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE; 158 159 //! Stores in <T> the parameters bounding the intervals 160 //! of continuity <S>. 161 //! 162 //! The array must provide enough room to accomodate 163 //! for the parameters. i.e. T.Length() > NbIntervals() 164 //! raises 165 //! OutOfRange from Standard 166 Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE; 167 168 Standard_EXPORT void GetShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree, Standard_Integer& NbPoles2d) Standard_OVERRIDE; 169 170 //! Returns the tolerance to reach in approximation 171 //! to respecte 172 //! BoundTol error at the Boundary 173 //! AngleTol tangent error at the Boundary 174 //! SurfTol error inside the surface. 175 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; 176 177 Standard_EXPORT void Knots (TColStd_Array1OfReal& TKnots) Standard_OVERRIDE; 178 179 Standard_EXPORT void Mults (TColStd_Array1OfInteger& TMults) Standard_OVERRIDE; 180 181 //! Used for the first and last section 182 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; 183 184 Standard_EXPORT void Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) Standard_OVERRIDE; 185 186 Standard_EXPORT void Resolution (const Standard_Integer IC2d, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const Standard_OVERRIDE; 187 188 189 190 191 protected: 192 193 194 195 196 197 private: 198 199 200 201 Handle(Adaptor3d_HSurface) surf; 202 Handle(Adaptor3d_HCurve) curv; 203 Handle(Adaptor3d_HCurve) guide; 204 Handle(Law_Function) law; 205 gp_Pnt pts; 206 gp_Pnt ptc; 207 gp_Pnt2d pt2d; 208 Standard_Real prmc; 209 Standard_Real dprmc; 210 Standard_Boolean istangent; 211 gp_Vec tgs; 212 gp_Vec2d tg2d; 213 gp_Vec tgc; 214 Standard_Real ray; 215 Standard_Integer choix; 216 gp_Vec d1gui; 217 gp_Vec d2gui; 218 gp_Vec nplan; 219 Standard_Real normtg; 220 Standard_Real maxang; 221 Standard_Real minang; 222 BlendFunc_SectionShape mySShape; 223 Convert_ParameterisationType myTConv; 224 225 226 }; 227 228 229 230 231 232 233 234 #endif // _BlendFunc_CSCircular_HeaderFile 235