Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-12 08:20:32

0001 // Created on: 1995-01-04
0002 // Created by: Jacques GOUSSARD
0003 // Copyright (c) 1995-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BlendFunc_CSCircular_HeaderFile
0018 #define _BlendFunc_CSCircular_HeaderFile
0019 
0020 #include <Adaptor3d_Surface.hxx>
0021 #include <gp_Pnt.hxx>
0022 #include <gp_Pnt2d.hxx>
0023 #include <gp_Vec.hxx>
0024 #include <gp_Vec2d.hxx>
0025 #include <BlendFunc_SectionShape.hxx>
0026 #include <Convert_ParameterisationType.hxx>
0027 #include <Blend_CSFunction.hxx>
0028 #include <math_Vector.hxx>
0029 #include <TColgp_Array1OfPnt.hxx>
0030 #include <TColgp_Array1OfVec.hxx>
0031 #include <TColgp_Array1OfPnt2d.hxx>
0032 #include <TColgp_Array1OfVec2d.hxx>
0033 #include <TColStd_Array1OfReal.hxx>
0034 #include <GeomAbs_Shape.hxx>
0035 #include <TColStd_Array1OfInteger.hxx>
0036 
0037 class Law_Function;
0038 class math_Matrix;
0039 class gp_Circ;
0040 class Blend_Point;
0041 
0042 class BlendFunc_CSCircular : public Blend_CSFunction
0043 {
0044 public:
0045   DEFINE_STANDARD_ALLOC
0046 
0047   //! Creates a function for a circular blending between
0048   //! a curve  <C> and a surface  <S>.  The direction of
0049   //! the planes are given by <CGuide>.  The position of
0050   //! the plane is  determined on  the  curve <C>.   <L>
0051   //! defines  the change of  parameter between  <C> and
0052   //! <CGuide>.  So, the planes are defined as described
0053   //! below :
0054   //! t is the current parameter on the guide line.
0055   //! Pguide = C(L(t)); Nguide = CGuide'(t)/||CGuide'(t)||
0056   Standard_EXPORT BlendFunc_CSCircular(const Handle(Adaptor3d_Surface)& S,
0057                                        const Handle(Adaptor3d_Curve)&   C,
0058                                        const Handle(Adaptor3d_Curve)&   CGuide,
0059                                        const Handle(Law_Function)&      L);
0060 
0061   Standard_EXPORT virtual Standard_Integer NbVariables() const Standard_OVERRIDE;
0062 
0063   //! returns the number of equations of the function (3).
0064   Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE;
0065 
0066   //! computes the values <F> of the Functions for the
0067   //! variable <X>.
0068   //! Returns True if the computation was done successfully,
0069   //! False otherwise.
0070   Standard_EXPORT Standard_Boolean Value(const math_Vector& X, math_Vector& F) Standard_OVERRIDE;
0071 
0072   //! returns the values <D> of the derivatives for the
0073   //! variable <X>.
0074   //! Returns True if the computation was done successfully,
0075   //! False otherwise.
0076   Standard_EXPORT Standard_Boolean Derivatives(const math_Vector& X,
0077                                                math_Matrix&       D) Standard_OVERRIDE;
0078 
0079   //! returns the values <F> of the functions and the derivatives
0080   //! <D> for the variable <X>.
0081   //! Returns True if the computation was done successfully,
0082   //! False otherwise.
0083   Standard_EXPORT Standard_Boolean Values(const math_Vector& X,
0084                                           math_Vector&       F,
0085                                           math_Matrix&       D) Standard_OVERRIDE;
0086 
0087   Standard_EXPORT void Set(const Standard_Real Param) Standard_OVERRIDE;
0088 
0089   Standard_EXPORT void Set(const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE;
0090 
0091   Standard_EXPORT void GetTolerance(math_Vector&        Tolerance,
0092                                     const Standard_Real Tol) const Standard_OVERRIDE;
0093 
0094   Standard_EXPORT void GetBounds(math_Vector& InfBound,
0095                                  math_Vector& SupBound) const Standard_OVERRIDE;
0096 
0097   Standard_EXPORT Standard_Boolean IsSolution(const math_Vector&  Sol,
0098                                               const Standard_Real Tol) Standard_OVERRIDE;
0099 
0100   Standard_EXPORT const gp_Pnt& PointOnS() const Standard_OVERRIDE;
0101 
0102   Standard_EXPORT const gp_Pnt& PointOnC() const Standard_OVERRIDE;
0103 
0104   //! Returns U,V coordinates of the point on the surface.
0105   Standard_EXPORT const gp_Pnt2d& Pnt2d() const Standard_OVERRIDE;
0106 
0107   //! Returns parameter of the point on the curve.
0108   Standard_EXPORT Standard_Real ParameterOnC() const Standard_OVERRIDE;
0109 
0110   Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE;
0111 
0112   Standard_EXPORT const gp_Vec& TangentOnS() const Standard_OVERRIDE;
0113 
0114   Standard_EXPORT const gp_Vec2d& Tangent2d() const Standard_OVERRIDE;
0115 
0116   Standard_EXPORT const gp_Vec& TangentOnC() const Standard_OVERRIDE;
0117 
0118   //! Returns the tangent vector at the section,
0119   //! at the beginning and the end of the section, and
0120   //! returns the normal (of the surface) at
0121   //! these points.
0122   Standard_EXPORT void Tangent(const Standard_Real U,
0123                                const Standard_Real V,
0124                                gp_Vec&             TgS,
0125                                gp_Vec&             NormS) const Standard_OVERRIDE;
0126 
0127   Standard_EXPORT void Set(const Standard_Real Radius, const Standard_Integer Choix);
0128 
0129   //! Sets the type of section generation for the
0130   //! approximations.
0131   Standard_EXPORT void Set(const BlendFunc_SectionShape TypeSection);
0132 
0133   Standard_EXPORT void Section(const Standard_Real Param,
0134                                const Standard_Real U,
0135                                const Standard_Real V,
0136                                const Standard_Real W,
0137                                Standard_Real&      Pdeb,
0138                                Standard_Real&      Pfin,
0139                                gp_Circ&            C);
0140 
0141   //! Used for the first and last section
0142   //! The method returns Standard_True if the derivatives
0143   //! are computed, otherwise it returns Standard_False.
0144   Standard_EXPORT virtual Standard_Boolean Section(const Blend_Point&    P,
0145                                                    TColgp_Array1OfPnt&   Poles,
0146                                                    TColgp_Array1OfVec&   DPoles,
0147                                                    TColgp_Array1OfVec&   D2Poles,
0148                                                    TColgp_Array1OfPnt2d& Poles2d,
0149                                                    TColgp_Array1OfVec2d& DPoles2d,
0150                                                    TColgp_Array1OfVec2d& D2Poles2d,
0151                                                    TColStd_Array1OfReal& Weigths,
0152                                                    TColStd_Array1OfReal& DWeigths,
0153                                                    TColStd_Array1OfReal& D2Weigths)
0154     Standard_OVERRIDE;
0155 
0156   Standard_EXPORT Standard_Boolean GetSection(const Standard_Real Param,
0157                                               const Standard_Real U,
0158                                               const Standard_Real V,
0159                                               const Standard_Real W,
0160                                               TColgp_Array1OfPnt& tabP,
0161                                               TColgp_Array1OfVec& tabV);
0162 
0163   //! Returns if the section is rational
0164   Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE;
0165 
0166   //! Returns the length of the maximum section
0167   Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE;
0168 
0169   //! Compute the minimal value of weight for each poles
0170   //! of all sections.
0171   Standard_EXPORT void GetMinimalWeight(TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE;
0172 
0173   //! Returns  the number  of  intervals for  continuity
0174   //! <S>. May be one if Continuity(me) >= <S>
0175   Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const Standard_OVERRIDE;
0176 
0177   //! Stores in <T> the parameters bounding the intervals
0178   //! of continuity <S>.
0179   //!
0180   //! The array must provide  enough room to  accommodate
0181   //! for the parameters. i.e. T.Length() > NbIntervals()
0182   //! raises
0183   //! OutOfRange from Standard
0184   Standard_EXPORT void Intervals(TColStd_Array1OfReal& T,
0185                                  const GeomAbs_Shape   S) const Standard_OVERRIDE;
0186 
0187   Standard_EXPORT void GetShape(Standard_Integer& NbPoles,
0188                                 Standard_Integer& NbKnots,
0189                                 Standard_Integer& Degree,
0190                                 Standard_Integer& NbPoles2d) Standard_OVERRIDE;
0191 
0192   //! Returns the tolerance to reach in approximation
0193   //! to respect
0194   //! BoundTol error at the Boundary
0195   //! AngleTol tangent error at the Boundary
0196   //! SurfTol error inside the surface.
0197   Standard_EXPORT void GetTolerance(const Standard_Real BoundTol,
0198                                     const Standard_Real SurfTol,
0199                                     const Standard_Real AngleTol,
0200                                     math_Vector&        Tol3d,
0201                                     math_Vector&        Tol1D) const Standard_OVERRIDE;
0202 
0203   Standard_EXPORT void Knots(TColStd_Array1OfReal& TKnots) Standard_OVERRIDE;
0204 
0205   Standard_EXPORT void Mults(TColStd_Array1OfInteger& TMults) Standard_OVERRIDE;
0206 
0207   //! Used for the first and last section
0208   Standard_EXPORT Standard_Boolean Section(const Blend_Point&    P,
0209                                            TColgp_Array1OfPnt&   Poles,
0210                                            TColgp_Array1OfVec&   DPoles,
0211                                            TColgp_Array1OfPnt2d& Poles2d,
0212                                            TColgp_Array1OfVec2d& DPoles2d,
0213                                            TColStd_Array1OfReal& Weigths,
0214                                            TColStd_Array1OfReal& DWeigths) Standard_OVERRIDE;
0215 
0216   Standard_EXPORT void Section(const Blend_Point&    P,
0217                                TColgp_Array1OfPnt&   Poles,
0218                                TColgp_Array1OfPnt2d& Poles2d,
0219                                TColStd_Array1OfReal& Weigths) Standard_OVERRIDE;
0220 
0221   Standard_EXPORT void Resolution(const Standard_Integer IC2d,
0222                                   const Standard_Real    Tol,
0223                                   Standard_Real&         TolU,
0224                                   Standard_Real&         TolV) const Standard_OVERRIDE;
0225 
0226 protected:
0227 private:
0228   Handle(Adaptor3d_Surface)    surf;
0229   Handle(Adaptor3d_Curve)      curv;
0230   Handle(Adaptor3d_Curve)      guide;
0231   Handle(Law_Function)         law;
0232   gp_Pnt                       pts;
0233   gp_Pnt                       ptc;
0234   gp_Pnt2d                     pt2d;
0235   Standard_Real                prmc;
0236   Standard_Real                dprmc;
0237   Standard_Boolean             istangent;
0238   gp_Vec                       tgs;
0239   gp_Vec2d                     tg2d;
0240   gp_Vec                       tgc;
0241   Standard_Real                ray;
0242   Standard_Integer             choix;
0243   gp_Vec                       d1gui;
0244   gp_Vec                       d2gui;
0245   gp_Vec                       nplan;
0246   Standard_Real                normtg;
0247   Standard_Real                maxang;
0248   Standard_Real                minang;
0249   BlendFunc_SectionShape       mySShape;
0250   Convert_ParameterisationType myTConv;
0251 };
0252 
0253 #endif // _BlendFunc_CSCircular_HeaderFile