Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-26 09:02:27

0001 // Created on: 1993-12-02
0002 // Created by: Jacques GOUSSARD
0003 // Copyright (c) 1993-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_CSConstRad_HeaderFile
0018 #define _BlendFunc_CSConstRad_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 <NCollection_Array1.hxx>
0030 #include <GeomAbs_Shape.hxx>
0031 #include <Standard_Integer.hxx>
0032 
0033 class math_Matrix;
0034 class gp_Circ;
0035 class Blend_Point;
0036 
0037 class BlendFunc_CSConstRad : public Blend_CSFunction
0038 {
0039 public:
0040   DEFINE_STANDARD_ALLOC
0041 
0042   Standard_EXPORT BlendFunc_CSConstRad(const occ::handle<Adaptor3d_Surface>& S,
0043                                        const occ::handle<Adaptor3d_Curve>&   C,
0044                                        const occ::handle<Adaptor3d_Curve>&   CGuide);
0045 
0046   //! returns the number of equations of the function (3).
0047   Standard_EXPORT int NbEquations() const override;
0048 
0049   //! computes the values <F> of the Functions for the
0050   //! variable <X>.
0051   //! Returns True if the computation was done successfully,
0052   //! False otherwise.
0053   Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override;
0054 
0055   //! returns the values <D> of the derivatives for the
0056   //! variable <X>.
0057   //! Returns True if the computation was done successfully,
0058   //! False otherwise.
0059   Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override;
0060 
0061   //! returns the values <F> of the functions and the derivatives
0062   //! <D> for the variable <X>.
0063   //! Returns True if the computation was done successfully,
0064   //! False otherwise.
0065   Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override;
0066 
0067   Standard_EXPORT void Set(const double Param) override;
0068 
0069   Standard_EXPORT void Set(const double First, const double Last) override;
0070 
0071   Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const double Tol) const override;
0072 
0073   Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const override;
0074 
0075   Standard_EXPORT bool IsSolution(const math_Vector& Sol, const double Tol) override;
0076 
0077   Standard_EXPORT const gp_Pnt& PointOnS() const override;
0078 
0079   Standard_EXPORT const gp_Pnt& PointOnC() const override;
0080 
0081   //! Returns U,V coordinates of the point on the surface.
0082   Standard_EXPORT const gp_Pnt2d& Pnt2d() const override;
0083 
0084   //! Returns parameter of the point on the curve.
0085   Standard_EXPORT double ParameterOnC() const override;
0086 
0087   Standard_EXPORT bool IsTangencyPoint() const override;
0088 
0089   Standard_EXPORT const gp_Vec& TangentOnS() const override;
0090 
0091   Standard_EXPORT const gp_Vec2d& Tangent2d() const override;
0092 
0093   Standard_EXPORT const gp_Vec& TangentOnC() const override;
0094 
0095   //! Returns the tangent vector at the section,
0096   //! at the beginning and the end of the section, and
0097   //! returns the normal (of the surface) at
0098   //! these points.
0099   Standard_EXPORT void Tangent(const double U,
0100                                const double V,
0101                                gp_Vec&      TgS,
0102                                gp_Vec&      NormS) const override;
0103 
0104   Standard_EXPORT void Set(const double Radius, const int Choix);
0105 
0106   //! Sets the type of section generation for the
0107   //! approximations.
0108   Standard_EXPORT void Set(const BlendFunc_SectionShape TypeSection);
0109 
0110   Standard_EXPORT void Section(const double Param,
0111                                const double U,
0112                                const double V,
0113                                const double W,
0114                                double&      Pdeb,
0115                                double&      Pfin,
0116                                gp_Circ&     C);
0117 
0118   //! Used for the first and last section
0119   //! The method returns true if the derivatives
0120   //! are computed, otherwise it returns false.
0121   Standard_EXPORT bool Section(const Blend_Point&            P,
0122                                NCollection_Array1<gp_Pnt>&   Poles,
0123                                NCollection_Array1<gp_Vec>&   DPoles,
0124                                NCollection_Array1<gp_Vec>&   D2Poles,
0125                                NCollection_Array1<gp_Pnt2d>& Poles2d,
0126                                NCollection_Array1<gp_Vec2d>& DPoles2d,
0127                                NCollection_Array1<gp_Vec2d>& D2Poles2d,
0128                                NCollection_Array1<double>&   Weigths,
0129                                NCollection_Array1<double>&   DWeigths,
0130                                NCollection_Array1<double>&   D2Weigths) override;
0131 
0132   Standard_EXPORT bool GetSection(const double                Param,
0133                                   const double                U,
0134                                   const double                V,
0135                                   const double                W,
0136                                   NCollection_Array1<gp_Pnt>& tabP,
0137                                   NCollection_Array1<gp_Vec>& tabV);
0138 
0139   //! Returns if the section is rational
0140   Standard_EXPORT bool IsRational() const override;
0141 
0142   //! Returns the length of the maximum section
0143   Standard_EXPORT double GetSectionSize() const override;
0144 
0145   //! Compute the minimal value of weight for each poles
0146   //! of all sections.
0147   Standard_EXPORT void GetMinimalWeight(NCollection_Array1<double>& Weigths) const override;
0148 
0149   //! Returns the number of intervals for continuity
0150   //! <S>. May be one if Continuity(me) >= <S>
0151   Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override;
0152 
0153   //! Stores in <T> the parameters bounding the intervals
0154   //! of continuity <S>.
0155   //! The array must provide enough room to accommodate
0156   //! for the parameters. i.e. T.Length() > NbIntervals()
0157   //! raises
0158   //! OutOfRange from Standard
0159   Standard_EXPORT void Intervals(NCollection_Array1<double>& T,
0160                                  const GeomAbs_Shape         S) const override;
0161 
0162   Standard_EXPORT void GetShape(int& NbPoles, int& NbKnots, int& Degree, int& NbPoles2d) override;
0163 
0164   //! Returns the tolerance to reach in approximation
0165   //! to respect
0166   //! BoundTol error at the Boundary
0167   //! AngleTol tangent error at the Boundary
0168   //! SurfTol error inside the surface.
0169   Standard_EXPORT void GetTolerance(const double BoundTol,
0170                                     const double SurfTol,
0171                                     const double AngleTol,
0172                                     math_Vector& Tol3d,
0173                                     math_Vector& Tol1D) const override;
0174 
0175   Standard_EXPORT void Knots(NCollection_Array1<double>& TKnots) override;
0176 
0177   Standard_EXPORT void Mults(NCollection_Array1<int>& TMults) override;
0178 
0179   //! Used for the first and last section
0180   Standard_EXPORT bool Section(const Blend_Point&            P,
0181                                NCollection_Array1<gp_Pnt>&   Poles,
0182                                NCollection_Array1<gp_Vec>&   DPoles,
0183                                NCollection_Array1<gp_Pnt2d>& Poles2d,
0184                                NCollection_Array1<gp_Vec2d>& DPoles2d,
0185                                NCollection_Array1<double>&   Weigths,
0186                                NCollection_Array1<double>&   DWeigths) override;
0187 
0188   Standard_EXPORT void Section(const Blend_Point&            P,
0189                                NCollection_Array1<gp_Pnt>&   Poles,
0190                                NCollection_Array1<gp_Pnt2d>& Poles2d,
0191                                NCollection_Array1<double>&   Weigths) override;
0192 
0193   Standard_EXPORT void Resolution(const int    IC2d,
0194                                   const double Tol,
0195                                   double&      TolU,
0196                                   double&      TolV) const override;
0197 
0198 private:
0199   occ::handle<Adaptor3d_Surface> surf;
0200   occ::handle<Adaptor3d_Curve>   curv;
0201   occ::handle<Adaptor3d_Curve>   guide;
0202   gp_Pnt                         pts;
0203   gp_Pnt                         ptc;
0204   gp_Pnt2d                       pt2d;
0205   double                         prmc;
0206   bool                           istangent;
0207   gp_Vec                         tgs;
0208   gp_Vec2d                       tg2d;
0209   gp_Vec                         tgc;
0210   double                         ray;
0211   int                            choix;
0212   gp_Pnt                         ptgui;
0213   gp_Vec                         d1gui;
0214   gp_Vec                         d2gui;
0215   gp_Vec                         nplan;
0216   double                         normtg;
0217   double                         theD;
0218   double                         maxang;
0219   double                         minang;
0220   BlendFunc_SectionShape         mySShape;
0221   Convert_ParameterisationType   myTConv;
0222 };
0223 
0224 #endif // _BlendFunc_CSConstRad_HeaderFile