Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:16:33

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_Ruled_HeaderFile
0018 #define _BlendFunc_Ruled_HeaderFile
0019 
0020 #include <Adaptor3d_Surface.hxx>
0021 #include <gp_Pnt.hxx>
0022 #include <gp_Vec.hxx>
0023 #include <gp_Vec2d.hxx>
0024 #include <Blend_Function.hxx>
0025 #include <math_Vector.hxx>
0026 #include <NCollection_Array1.hxx>
0027 #include <GeomAbs_Shape.hxx>
0028 #include <Standard_Integer.hxx>
0029 #include <gp_Pnt2d.hxx>
0030 
0031 class math_Matrix;
0032 class Blend_Point;
0033 class gp_Ax1;
0034 
0035 class BlendFunc_Ruled : public Blend_Function
0036 {
0037 public:
0038   DEFINE_STANDARD_ALLOC
0039 
0040   Standard_EXPORT BlendFunc_Ruled(const occ::handle<Adaptor3d_Surface>& S1,
0041                                   const occ::handle<Adaptor3d_Surface>& S2,
0042                                   const occ::handle<Adaptor3d_Curve>&   C);
0043 
0044   //! returns the number of equations of the function.
0045   Standard_EXPORT int NbEquations() const override;
0046 
0047   //! computes the values <F> of the Functions for the
0048   //! variable <X>.
0049   //! Returns True if the computation was done successfully,
0050   //! False otherwise.
0051   Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override;
0052 
0053   //! returns the values <D> of the derivatives for the
0054   //! variable <X>.
0055   //! Returns True if the computation was done successfully,
0056   //! False otherwise.
0057   Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override;
0058 
0059   //! returns the values <F> of the functions and the derivatives
0060   //! <D> for the variable <X>.
0061   //! Returns True if the computation was done successfully,
0062   //! False otherwise.
0063   Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override;
0064 
0065   Standard_EXPORT void Set(const double Param) override;
0066 
0067   Standard_EXPORT void Set(const double First, const double Last) override;
0068 
0069   Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const double Tol) const override;
0070 
0071   Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const override;
0072 
0073   Standard_EXPORT bool IsSolution(const math_Vector& Sol, const double Tol) override;
0074 
0075   //! Returns the minimal Distance between two
0076   //! extremities of calculated sections.
0077   Standard_EXPORT double GetMinimalDistance() const override;
0078 
0079   Standard_EXPORT const gp_Pnt& PointOnS1() const override;
0080 
0081   Standard_EXPORT const gp_Pnt& PointOnS2() const override;
0082 
0083   Standard_EXPORT bool IsTangencyPoint() const override;
0084 
0085   Standard_EXPORT const gp_Vec& TangentOnS1() const override;
0086 
0087   Standard_EXPORT const gp_Vec2d& Tangent2dOnS1() const override;
0088 
0089   Standard_EXPORT const gp_Vec& TangentOnS2() const override;
0090 
0091   Standard_EXPORT const gp_Vec2d& Tangent2dOnS2() const override;
0092 
0093   //! Returns the tangent vector at the section,
0094   //! at the beginning and the end of the section, and
0095   //! returns the normal (of the surfaces) at
0096   //! these points.
0097   Standard_EXPORT void Tangent(const double U1,
0098                                const double V1,
0099                                const double U2,
0100                                const double V2,
0101                                gp_Vec&      TgFirst,
0102                                gp_Vec&      TgLast,
0103                                gp_Vec&      NormFirst,
0104                                gp_Vec&      NormLast) const override;
0105 
0106   Standard_EXPORT bool GetSection(const double                Param,
0107                                   const double                U1,
0108                                   const double                V1,
0109                                   const double                U2,
0110                                   const double                V2,
0111                                   NCollection_Array1<gp_Pnt>& tabP,
0112                                   NCollection_Array1<gp_Vec>& tabV);
0113 
0114   //! Returns False
0115   Standard_EXPORT bool IsRational() const override;
0116 
0117   //! Returns the length of the maximum section
0118   Standard_EXPORT double GetSectionSize() const override;
0119 
0120   //! Compute the minimal value of weight for each poles
0121   //! of all sections.
0122   Standard_EXPORT void GetMinimalWeight(NCollection_Array1<double>& Weigths) const override;
0123 
0124   //! Returns the number of intervals for continuity
0125   //! <S>. May be one if Continuity(me) >= <S>
0126   Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override;
0127 
0128   //! Stores in <T> the parameters bounding the intervals
0129   //! of continuity <S>.
0130   //!
0131   //! The array must provide enough room to accommodate
0132   //! for the parameters. i.e. T.Length() > NbIntervals()
0133   //! raises OutOfRange from Standard
0134   Standard_EXPORT void Intervals(NCollection_Array1<double>& T,
0135                                  const GeomAbs_Shape         S) const override;
0136 
0137   Standard_EXPORT void GetShape(int& NbPoles, int& NbKnots, int& Degree, int& NbPoles2d) override;
0138 
0139   //! Returns the tolerance to reach in approximation
0140   //! to respect
0141   //! BoundTol error at the Boundary
0142   //! AngleTol tangent error at the Boundary
0143   //! SurfTol error inside the surface.
0144   Standard_EXPORT void GetTolerance(const double BoundTol,
0145                                     const double SurfTol,
0146                                     const double AngleTol,
0147                                     math_Vector& Tol3d,
0148                                     math_Vector& Tol1D) const override;
0149 
0150   Standard_EXPORT void Knots(NCollection_Array1<double>& TKnots) override;
0151 
0152   Standard_EXPORT void Mults(NCollection_Array1<int>& TMults) override;
0153 
0154   //! Used for the first and last section
0155   Standard_EXPORT bool Section(const Blend_Point&            P,
0156                                NCollection_Array1<gp_Pnt>&   Poles,
0157                                NCollection_Array1<gp_Vec>&   DPoles,
0158                                NCollection_Array1<gp_Vec>&   D2Poles,
0159                                NCollection_Array1<gp_Pnt2d>& Poles2d,
0160                                NCollection_Array1<gp_Vec2d>& DPoles2d,
0161                                NCollection_Array1<gp_Vec2d>& D2Poles2d,
0162                                NCollection_Array1<double>&   Weigths,
0163                                NCollection_Array1<double>&   DWeigths,
0164                                NCollection_Array1<double>&   D2Weigths) override;
0165 
0166   //! Used for the first and last section
0167   Standard_EXPORT bool Section(const Blend_Point&            P,
0168                                NCollection_Array1<gp_Pnt>&   Poles,
0169                                NCollection_Array1<gp_Vec>&   DPoles,
0170                                NCollection_Array1<gp_Pnt2d>& Poles2d,
0171                                NCollection_Array1<gp_Vec2d>& DPoles2d,
0172                                NCollection_Array1<double>&   Weigths,
0173                                NCollection_Array1<double>&   DWeigths) override;
0174 
0175   Standard_EXPORT void Section(const Blend_Point&            P,
0176                                NCollection_Array1<gp_Pnt>&   Poles,
0177                                NCollection_Array1<gp_Pnt2d>& Poles2d,
0178                                NCollection_Array1<double>&   Weigths) override;
0179 
0180   Standard_EXPORT gp_Ax1 AxeRot(const double Prm);
0181 
0182   Standard_EXPORT void Resolution(const int    IC2d,
0183                                   const double Tol,
0184                                   double&      TolU,
0185                                   double&      TolV) const override;
0186 
0187 private:
0188   occ::handle<Adaptor3d_Surface> surf1;
0189   occ::handle<Adaptor3d_Surface> surf2;
0190   occ::handle<Adaptor3d_Curve>   curv;
0191   gp_Pnt                         pts1;
0192   gp_Pnt                         pts2;
0193   bool                           istangent;
0194   gp_Vec                         tg1;
0195   gp_Vec2d                       tg12d;
0196   gp_Vec                         tg2;
0197   gp_Vec2d                       tg22d;
0198   gp_Pnt                         ptgui;
0199   gp_Vec                         d1gui;
0200   gp_Vec                         d2gui;
0201   gp_Vec                         nplan;
0202   double                         normtg;
0203   double                         theD;
0204   double                         distmin;
0205 };
0206 
0207 #endif // _BlendFunc_Ruled_HeaderFile