| 1 | // Created on: 1997-07-11 |
| 2 | // Created by: Philippe MANGIN |
| 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 _GeomFill_CircularBlendFunc_HeaderFile |
| 18 | #define _GeomFill_CircularBlendFunc_HeaderFile |
| 19 | |
| 20 | #include <Standard.hxx> |
| 21 | #include <Standard_Type.hxx> |
| 22 | |
| 23 | #include <gp_Pnt.hxx> |
| 24 | #include <Standard_Real.hxx> |
| 25 | #include <Standard_Integer.hxx> |
| 26 | #include <Convert_ParameterisationType.hxx> |
| 27 | #include <Standard_Boolean.hxx> |
| 28 | #include <Approx_SweepFunction.hxx> |
| 29 | #include <TColgp_Array1OfPnt.hxx> |
| 30 | #include <TColgp_Array1OfPnt2d.hxx> |
| 31 | #include <TColStd_Array1OfReal.hxx> |
| 32 | #include <TColgp_Array1OfVec.hxx> |
| 33 | #include <TColgp_Array1OfVec2d.hxx> |
| 34 | #include <TColStd_Array1OfInteger.hxx> |
| 35 | #include <GeomAbs_Shape.hxx> |
| 36 | class Adaptor3d_HCurve; |
| 37 | class Standard_OutOfRange; |
| 38 | class gp_Pnt; |
| 39 | |
| 40 | |
| 41 | class GeomFill_CircularBlendFunc; |
| 42 | DEFINE_STANDARD_HANDLE(GeomFill_CircularBlendFunc, Approx_SweepFunction) |
| 43 | |
| 44 | //! Circular Blend Function to approximate by |
| 45 | //! SweepApproximation from Approx |
| 46 | class GeomFill_CircularBlendFunc : public Approx_SweepFunction |
| 47 | { |
| 48 | |
| 49 | public: |
| 50 | |
| 51 | |
| 52 | //! Create a Blend with a constant radius with 2 |
| 53 | //! guide-line. <FShape> sets the type of fillet |
| 54 | //! surface. The -- default value is Convert_TgtThetaOver2 (classical -- |
| 55 | //! nurbs -- representation of circles). |
| 56 | //! ChFi3d_QuasiAngular -- corresponds to a nurbs |
| 57 | //! representation of circles -- which |
| 58 | //! parameterisation matches the circle one. -- |
| 59 | //! ChFi3d_Polynomial corresponds to a polynomial -- |
| 60 | //! representation of circles. |
| 61 | Standard_EXPORT GeomFill_CircularBlendFunc(const Handle(Adaptor3d_HCurve)& Path, const Handle(Adaptor3d_HCurve)& Curve1, const Handle(Adaptor3d_HCurve)& Curve2, const Standard_Real Radius, const Standard_Boolean Polynomial = Standard_False); |
| 62 | |
| 63 | //! compute the section for v = param |
| 64 | Standard_EXPORT virtual Standard_Boolean D0 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) Standard_OVERRIDE; |
| 65 | |
| 66 | //! compute the first derivative in v direction of the |
| 67 | //! section for v = param |
| 68 | Standard_EXPORT virtual Standard_Boolean D1 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths) Standard_OVERRIDE; |
| 69 | |
| 70 | //! compute the second derivative in v direction of the |
| 71 | //! section for v = param |
| 72 | Standard_EXPORT virtual Standard_Boolean D2 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, 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; |
| 73 | |
| 74 | //! get the number of 2d curves to approximate. |
| 75 | Standard_EXPORT virtual Standard_Integer Nb2dCurves() const Standard_OVERRIDE; |
| 76 | |
| 77 | //! get the format of an section |
| 78 | Standard_EXPORT virtual void SectionShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree) const Standard_OVERRIDE; |
| 79 | |
| 80 | //! get the Knots of the section |
| 81 | Standard_EXPORT virtual void Knots (TColStd_Array1OfReal& TKnots) const Standard_OVERRIDE; |
| 82 | |
| 83 | //! get the Multplicities of the section |
| 84 | Standard_EXPORT virtual void Mults (TColStd_Array1OfInteger& TMults) const Standard_OVERRIDE; |
| 85 | |
| 86 | //! Returns if the section is rationnal or not |
| 87 | Standard_EXPORT virtual Standard_Boolean IsRational() const Standard_OVERRIDE; |
| 88 | |
| 89 | //! Returns the number of intervals for continuity |
| 90 | //! <S>. May be one if Continuity(me) >= <S> |
| 91 | Standard_EXPORT virtual Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE; |
| 92 | |
| 93 | //! Stores in <T> the parameters bounding the intervals |
| 94 | //! of continuity <S>. |
| 95 | //! |
| 96 | //! The array must provide enough room to accomodate |
| 97 | //! for the parameters. i.e. T.Length() > NbIntervals() |
| 98 | Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE; |
| 99 | |
| 100 | //! Sets the bounds of the parametric interval on |
| 101 | //! the fonction |
| 102 | //! This determines the derivatives in these values if the |
| 103 | //! function is not Cn. |
| 104 | Standard_EXPORT virtual void SetInterval (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE; |
| 105 | |
| 106 | //! Returns the tolerance to reach in approximation |
| 107 | //! to respecte |
| 108 | //! BoundTol error at the Boundary |
| 109 | //! AngleTol tangent error at the Boundary (in radian) |
| 110 | //! SurfTol error inside the surface. |
| 111 | Standard_EXPORT virtual void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, TColStd_Array1OfReal& Tol3d) const Standard_OVERRIDE; |
| 112 | |
| 113 | //! Is usfull, if (me) have to be run numerical |
| 114 | //! algorithme to perform D0, D1 or D2 |
| 115 | Standard_EXPORT virtual void SetTolerance (const Standard_Real Tol3d, const Standard_Real Tol2d) Standard_OVERRIDE; |
| 116 | |
| 117 | //! Get the barycentre of Surface. An very poor |
| 118 | //! estimation is sufficent. This information is usefull |
| 119 | //! to perform well conditionned rational approximation. |
| 120 | Standard_EXPORT virtual gp_Pnt BarycentreOfSurf() const Standard_OVERRIDE; |
| 121 | |
| 122 | //! Returns the length of the maximum section. This |
| 123 | //! information is usefull to perform well conditionned rational |
| 124 | //! approximation. |
| 125 | Standard_EXPORT virtual Standard_Real MaximalSection() const Standard_OVERRIDE; |
| 126 | |
| 127 | //! Compute the minimal value of weight for each poles |
| 128 | //! of all sections. This information is usefull to |
| 129 | //! perform well conditionned rational approximation. |
| 130 | Standard_EXPORT virtual void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE; |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | DEFINE_STANDARD_RTTIEXT(GeomFill_CircularBlendFunc,Approx_SweepFunction) |
| 136 | |
| 137 | protected: |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | private: |
| 143 | |
| 144 | |
| 145 | Standard_EXPORT void Discret(); |
| 146 | |
| 147 | gp_Pnt myBary; |
| 148 | Standard_Real myRadius; |
| 149 | Standard_Real maxang; |
| 150 | Standard_Real minang; |
| 151 | Standard_Real distmin; |
| 152 | Handle(Adaptor3d_HCurve) myPath; |
| 153 | Handle(Adaptor3d_HCurve) myCurve1; |
| 154 | Handle(Adaptor3d_HCurve) myCurve2; |
| 155 | Handle(Adaptor3d_HCurve) myTPath; |
| 156 | Handle(Adaptor3d_HCurve) myTCurve1; |
| 157 | Handle(Adaptor3d_HCurve) myTCurve2; |
| 158 | Standard_Integer myDegree; |
| 159 | Standard_Integer myNbKnots; |
| 160 | Standard_Integer myNbPoles; |
| 161 | Convert_ParameterisationType myTConv; |
| 162 | Standard_Boolean myreverse; |
| 163 | |
| 164 | |
| 165 | }; |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | #endif // _GeomFill_CircularBlendFunc_HeaderFile |