Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-17 09:19:49

0001 // Created on: 1997-02-06
0002 // Created by: Laurent BOURESCHE
0003 // Copyright (c) 1997-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 _BRepBlend_SurfRstConstRad_HeaderFile
0018 #define _BRepBlend_SurfRstConstRad_HeaderFile
0019 
0020 #include <Adaptor3d_Surface.hxx>
0021 #include <Adaptor3d_CurveOnSurface.hxx>
0022 #include <gp_Pnt.hxx>
0023 #include <gp_Pnt2d.hxx>
0024 #include <gp_Vec.hxx>
0025 #include <gp_Vec2d.hxx>
0026 #include <BlendFunc_SectionShape.hxx>
0027 #include <Convert_ParameterisationType.hxx>
0028 #include <Blend_SurfRstFunction.hxx>
0029 #include <math_Vector.hxx>
0030 #include <NCollection_Array1.hxx>
0031 #include <GeomAbs_Shape.hxx>
0032 #include <Standard_Integer.hxx>
0033 
0034 class math_Matrix;
0035 class gp_Circ;
0036 class Blend_Point;
0037 
0038 //! Copy of CSConstRad with pcurve on surface
0039 //! as support.
0040 class BRepBlend_SurfRstConstRad : public Blend_SurfRstFunction
0041 {
0042 public:
0043   DEFINE_STANDARD_ALLOC
0044 
0045   Standard_EXPORT BRepBlend_SurfRstConstRad(const occ::handle<Adaptor3d_Surface>& Surf,
0046                                             const occ::handle<Adaptor3d_Surface>& SurfRst,
0047                                             const occ::handle<Adaptor2d_Curve2d>& Rst,
0048                                             const occ::handle<Adaptor3d_Curve>&   CGuide);
0049 
0050   //! Returns 3.
0051   Standard_EXPORT int NbVariables() const override;
0052 
0053   //! Returns 3.
0054   Standard_EXPORT int NbEquations() const override;
0055 
0056   //! computes the values <F> of the Functions for the
0057   //! variable <X>.
0058   //! Returns True if the computation was done successfully,
0059   //! False otherwise.
0060   Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override;
0061 
0062   //! returns the values <D> of the derivatives for the
0063   //! variable <X>.
0064   //! Returns True if the computation was done successfully,
0065   //! False otherwise.
0066   Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override;
0067 
0068   //! returns the values <F> of the functions and the derivatives
0069   //! <D> for the variable <X>.
0070   //! Returns True if the computation was done successfully,
0071   //! False otherwise.
0072   Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override;
0073 
0074   Standard_EXPORT void Set(const occ::handle<Adaptor3d_Surface>& SurfRef,
0075                            const occ::handle<Adaptor2d_Curve2d>& RstRef);
0076 
0077   Standard_EXPORT void Set(const double Param) override;
0078 
0079   //! Sets the bounds of the parametric interval on
0080   //! the guide line.
0081   //! This determines the derivatives in these values if the
0082   //! function is not Cn.
0083   Standard_EXPORT void Set(const double First, const double Last) override;
0084 
0085   Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const double Tol) const override;
0086 
0087   Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const override;
0088 
0089   Standard_EXPORT bool IsSolution(const math_Vector& Sol, const double Tol) override;
0090 
0091   //! Returns the minimal Distance between two
0092   //! extremities of calculated sections.
0093   Standard_EXPORT double GetMinimalDistance() const override;
0094 
0095   Standard_EXPORT const gp_Pnt& PointOnS() const override;
0096 
0097   Standard_EXPORT const gp_Pnt& PointOnRst() const override;
0098 
0099   //! Returns U,V coordinates of the point on the surface.
0100   Standard_EXPORT const gp_Pnt2d& Pnt2dOnS() const override;
0101 
0102   //! Returns U,V coordinates of the point on the curve on
0103   //! surface.
0104   Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst() const override;
0105 
0106   //! Returns parameter of the point on the curve.
0107   Standard_EXPORT double ParameterOnRst() const override;
0108 
0109   Standard_EXPORT bool IsTangencyPoint() const override;
0110 
0111   Standard_EXPORT const gp_Vec& TangentOnS() const override;
0112 
0113   Standard_EXPORT const gp_Vec2d& Tangent2dOnS() const override;
0114 
0115   Standard_EXPORT const gp_Vec& TangentOnRst() const override;
0116 
0117   Standard_EXPORT const gp_Vec2d& Tangent2dOnRst() const override;
0118 
0119   //! Enables implementation of a criterion of decrochage
0120   //! specific to the function.
0121   //! Warning: Can be called without previous call of IsSolution
0122   //! but the values calculated can be senseless.
0123   Standard_EXPORT bool Decroch(const math_Vector& Sol, gp_Vec& NS, gp_Vec& TgS) const override;
0124 
0125   Standard_EXPORT void Set(const double Radius, const int Choix);
0126 
0127   //! Sets the type of section generation for the
0128   //! approximations.
0129   Standard_EXPORT void Set(const BlendFunc_SectionShape TypeSection);
0130 
0131   Standard_EXPORT void Section(const double Param,
0132                                const double U,
0133                                const double V,
0134                                const double W,
0135                                double&      Pdeb,
0136                                double&      Pfin,
0137                                gp_Circ&     C);
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   Standard_EXPORT void Intervals(NCollection_Array1<double>& T,
0158                                  const GeomAbs_Shape         S) const override;
0159 
0160   Standard_EXPORT void GetShape(int& NbPoles, int& NbKnots, int& Degree, int& NbPoles2d) override;
0161 
0162   //! Returns the tolerance to reach in approximation
0163   //! to respect
0164   //! BoundTol error at the Boundary
0165   //! AngleTol tangent error at the Boundary
0166   //! SurfTol error inside the surface.
0167   Standard_EXPORT void GetTolerance(const double BoundTol,
0168                                     const double SurfTol,
0169                                     const double AngleTol,
0170                                     math_Vector& Tol3d,
0171                                     math_Vector& Tol1D) const override;
0172 
0173   Standard_EXPORT void Knots(NCollection_Array1<double>& TKnots) override;
0174 
0175   Standard_EXPORT void Mults(NCollection_Array1<int>& TMults) override;
0176 
0177   //! Used for the first and last section
0178   Standard_EXPORT bool Section(const Blend_Point&            P,
0179                                NCollection_Array1<gp_Pnt>&   Poles,
0180                                NCollection_Array1<gp_Vec>&   DPoles,
0181                                NCollection_Array1<gp_Pnt2d>& Poles2d,
0182                                NCollection_Array1<gp_Vec2d>& DPoles2d,
0183                                NCollection_Array1<double>&   Weigths,
0184                                NCollection_Array1<double>&   DWeigths) override;
0185 
0186   //! Used for the first and last section
0187   //! The method returns true if the derivatives
0188   //! are computed, otherwise it returns false.
0189   Standard_EXPORT bool Section(const Blend_Point&            P,
0190                                NCollection_Array1<gp_Pnt>&   Poles,
0191                                NCollection_Array1<gp_Vec>&   DPoles,
0192                                NCollection_Array1<gp_Vec>&   D2Poles,
0193                                NCollection_Array1<gp_Pnt2d>& Poles2d,
0194                                NCollection_Array1<gp_Vec2d>& DPoles2d,
0195                                NCollection_Array1<gp_Vec2d>& D2Poles2d,
0196                                NCollection_Array1<double>&   Weigths,
0197                                NCollection_Array1<double>&   DWeigths,
0198                                NCollection_Array1<double>&   D2Weigths) override;
0199 
0200   Standard_EXPORT void Section(const Blend_Point&            P,
0201                                NCollection_Array1<gp_Pnt>&   Poles,
0202                                NCollection_Array1<gp_Pnt2d>& Poles2d,
0203                                NCollection_Array1<double>&   Weigths) override;
0204 
0205   Standard_EXPORT void Resolution(const int    IC2d,
0206                                   const double Tol,
0207                                   double&      TolU,
0208                                   double&      TolV) const override;
0209 
0210 private:
0211   occ::handle<Adaptor3d_Surface> surf;
0212   occ::handle<Adaptor3d_Surface> surfrst;
0213   occ::handle<Adaptor2d_Curve2d> rst;
0214   Adaptor3d_CurveOnSurface       cons;
0215   occ::handle<Adaptor3d_Curve>   guide;
0216   occ::handle<Adaptor3d_Curve>   tguide;
0217   gp_Pnt                         pts;
0218   gp_Pnt                         ptrst;
0219   gp_Pnt2d                       pt2ds;
0220   gp_Pnt2d                       pt2drst;
0221   double                         prmrst;
0222   bool                           istangent;
0223   gp_Vec                         tgs;
0224   gp_Vec2d                       tg2ds;
0225   gp_Vec                         tgrst;
0226   gp_Vec2d                       tg2drst;
0227   double                         ray;
0228   int                            choix;
0229   gp_Pnt                         ptgui;
0230   gp_Vec                         d1gui;
0231   gp_Vec                         d2gui;
0232   gp_Vec                         nplan;
0233   double                         normtg;
0234   double                         theD;
0235   occ::handle<Adaptor3d_Surface> surfref;
0236   occ::handle<Adaptor2d_Curve2d> rstref;
0237   double                         maxang;
0238   double                         minang;
0239   double                         distmin;
0240   BlendFunc_SectionShape         mySShape;
0241   Convert_ParameterisationType   myTConv;
0242 };
0243 
0244 #endif // _BRepBlend_SurfRstConstRad_HeaderFile