Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:16:52

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_RstRstConstRad_HeaderFile
0018 #define _BRepBlend_RstRstConstRad_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_RstRstFunction.hxx>
0029 #include <math_Vector.hxx>
0030 #include <Blend_DecrochStatus.hxx>
0031 #include <NCollection_Array1.hxx>
0032 #include <GeomAbs_Shape.hxx>
0033 #include <Standard_Integer.hxx>
0034 
0035 class math_Matrix;
0036 class gp_Circ;
0037 class Blend_Point;
0038 
0039 //! Copy of CSConstRad with a pcurve on surface
0040 //! as support.
0041 class BRepBlend_RstRstConstRad : public Blend_RstRstFunction
0042 {
0043 public:
0044   DEFINE_STANDARD_ALLOC
0045 
0046   Standard_EXPORT BRepBlend_RstRstConstRad(const occ::handle<Adaptor3d_Surface>& Surf1,
0047                                            const occ::handle<Adaptor2d_Curve2d>& Rst1,
0048                                            const occ::handle<Adaptor3d_Surface>& Surf2,
0049                                            const occ::handle<Adaptor2d_Curve2d>& Rst2,
0050                                            const occ::handle<Adaptor3d_Curve>&   CGuide);
0051 
0052   //! Returns 2.
0053   Standard_EXPORT int NbVariables() const override;
0054 
0055   //! Returns 2.
0056   Standard_EXPORT int NbEquations() const override;
0057 
0058   //! computes the values <F> of the Functions for the
0059   //! variable <X>.
0060   //! Returns True if the computation was done successfully,
0061   //! False otherwise.
0062   Standard_EXPORT bool Value(const math_Vector& X, math_Vector& F) override;
0063 
0064   //! returns the values <D> of the derivatives for the
0065   //! variable <X>.
0066   //! Returns True if the computation was done successfully,
0067   //! False otherwise.
0068   Standard_EXPORT bool Derivatives(const math_Vector& X, math_Matrix& D) override;
0069 
0070   //! returns the values <F> of the functions and the derivatives
0071   //! <D> for the variable <X>.
0072   //! Returns True if the computation was done successfully,
0073   //! False otherwise.
0074   Standard_EXPORT bool Values(const math_Vector& X, math_Vector& F, math_Matrix& D) override;
0075 
0076   Standard_EXPORT void Set(const occ::handle<Adaptor3d_Surface>& SurfRef1,
0077                            const occ::handle<Adaptor2d_Curve2d>& RstRef1,
0078                            const occ::handle<Adaptor3d_Surface>& SurfRef2,
0079                            const occ::handle<Adaptor2d_Curve2d>& RstRef2);
0080 
0081   Standard_EXPORT void Set(const double Param) override;
0082 
0083   //! Sets the bounds of the parametric interval on
0084   //! the guide line.
0085   //! This determines the derivatives in these values if the
0086   //! function is not Cn.
0087   Standard_EXPORT void Set(const double First, const double Last) override;
0088 
0089   Standard_EXPORT void GetTolerance(math_Vector& Tolerance, const double Tol) const override;
0090 
0091   Standard_EXPORT void GetBounds(math_Vector& InfBound, math_Vector& SupBound) const override;
0092 
0093   Standard_EXPORT bool IsSolution(const math_Vector& Sol, const double Tol) override;
0094 
0095   //! Returns the minimal Distance between two
0096   //! extremities of calculated sections.
0097   Standard_EXPORT double GetMinimalDistance() const override;
0098 
0099   Standard_EXPORT const gp_Pnt& PointOnRst1() const override;
0100 
0101   Standard_EXPORT const gp_Pnt& PointOnRst2() const override;
0102 
0103   //! Returns U,V coordinates of the point on the surface.
0104   Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst1() const override;
0105 
0106   //! Returns U,V coordinates of the point on the curve on
0107   //! surface.
0108   Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst2() const override;
0109 
0110   //! Returns parameter of the point on the curve.
0111   Standard_EXPORT double ParameterOnRst1() const override;
0112 
0113   //! Returns parameter of the point on the curve.
0114   Standard_EXPORT double ParameterOnRst2() const override;
0115 
0116   Standard_EXPORT bool IsTangencyPoint() const override;
0117 
0118   Standard_EXPORT const gp_Vec& TangentOnRst1() const override;
0119 
0120   Standard_EXPORT const gp_Vec2d& Tangent2dOnRst1() const override;
0121 
0122   Standard_EXPORT const gp_Vec& TangentOnRst2() const override;
0123 
0124   Standard_EXPORT const gp_Vec2d& Tangent2dOnRst2() const override;
0125 
0126   //! Allows implementing a specific termination criterion
0127   //! for the function.
0128   Standard_EXPORT Blend_DecrochStatus Decroch(const math_Vector& Sol,
0129                                               gp_Vec&            NRst1,
0130                                               gp_Vec&            TgRst1,
0131                                               gp_Vec&            NRst2,
0132                                               gp_Vec&            TgRst2) const override;
0133 
0134   Standard_EXPORT void Set(const double Radius, const int Choix);
0135 
0136   //! Sets the type of section generation for the
0137   //! approximations.
0138   Standard_EXPORT void Set(const BlendFunc_SectionShape TypeSection);
0139 
0140   //! Give the center of circle define by PtRst1, PtRst2 and
0141   //! radius ray.
0142   Standard_EXPORT bool CenterCircleRst1Rst2(const gp_Pnt& PtRst1,
0143                                             const gp_Pnt& PtRst2,
0144                                             const gp_Vec& np,
0145                                             gp_Pnt&       Center,
0146                                             gp_Vec&       VdMed) const;
0147 
0148   Standard_EXPORT void Section(const double Param,
0149                                const double U,
0150                                const double V,
0151                                double&      Pdeb,
0152                                double&      Pfin,
0153                                gp_Circ&     C);
0154 
0155   //! Returns if the section is rational
0156   Standard_EXPORT bool IsRational() const override;
0157 
0158   //! Returns the length of the maximum section
0159   Standard_EXPORT double GetSectionSize() const override;
0160 
0161   //! Compute the minimal value of weight for each poles
0162   //! of all sections.
0163   Standard_EXPORT void GetMinimalWeight(NCollection_Array1<double>& Weigths) const override;
0164 
0165   //! Returns the number of intervals for continuity
0166   //! <S>. May be one if Continuity(me) >= <S>
0167   Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override;
0168 
0169   //! Stores in <T> the parameters bounding the intervals
0170   //! of continuity <S>.
0171   //! The array must provide enough room to accommodate
0172   //! for the parameters. i.e. T.Length() > NbIntervals()
0173   Standard_EXPORT void Intervals(NCollection_Array1<double>& T,
0174                                  const GeomAbs_Shape         S) const override;
0175 
0176   Standard_EXPORT void GetShape(int& NbPoles, int& NbKnots, int& Degree, int& NbPoles2d) override;
0177 
0178   //! Returns the tolerance to reach in approximation
0179   //! to respect
0180   //! BoundTol error at the Boundary
0181   //! AngleTol tangent error at the Boundary
0182   //! SurfTol error inside the surface.
0183   Standard_EXPORT void GetTolerance(const double BoundTol,
0184                                     const double SurfTol,
0185                                     const double AngleTol,
0186                                     math_Vector& Tol3d,
0187                                     math_Vector& Tol1D) const override;
0188 
0189   Standard_EXPORT void Knots(NCollection_Array1<double>& TKnots) override;
0190 
0191   Standard_EXPORT void Mults(NCollection_Array1<int>& TMults) override;
0192 
0193   //! Used for the first and last section
0194   Standard_EXPORT bool Section(const Blend_Point&            P,
0195                                NCollection_Array1<gp_Pnt>&   Poles,
0196                                NCollection_Array1<gp_Vec>&   DPoles,
0197                                NCollection_Array1<gp_Pnt2d>& Poles2d,
0198                                NCollection_Array1<gp_Vec2d>& DPoles2d,
0199                                NCollection_Array1<double>&   Weigths,
0200                                NCollection_Array1<double>&   DWeigths) override;
0201 
0202   Standard_EXPORT void Section(const Blend_Point&            P,
0203                                NCollection_Array1<gp_Pnt>&   Poles,
0204                                NCollection_Array1<gp_Pnt2d>& Poles2d,
0205                                NCollection_Array1<double>&   Weigths) override;
0206 
0207   //! Used for the first and last section
0208   //! The method returns true if the derivatives
0209   //! are computed, otherwise it returns false.
0210   Standard_EXPORT bool Section(const Blend_Point&            P,
0211                                NCollection_Array1<gp_Pnt>&   Poles,
0212                                NCollection_Array1<gp_Vec>&   DPoles,
0213                                NCollection_Array1<gp_Vec>&   D2Poles,
0214                                NCollection_Array1<gp_Pnt2d>& Poles2d,
0215                                NCollection_Array1<gp_Vec2d>& DPoles2d,
0216                                NCollection_Array1<gp_Vec2d>& D2Poles2d,
0217                                NCollection_Array1<double>&   Weigths,
0218                                NCollection_Array1<double>&   DWeigths,
0219                                NCollection_Array1<double>&   D2Weigths) override;
0220 
0221   Standard_EXPORT void Resolution(const int    IC2d,
0222                                   const double Tol,
0223                                   double&      TolU,
0224                                   double&      TolV) const override;
0225 
0226 private:
0227   occ::handle<Adaptor3d_Surface> surf1;
0228   occ::handle<Adaptor3d_Surface> surf2;
0229   occ::handle<Adaptor2d_Curve2d> rst1;
0230   occ::handle<Adaptor2d_Curve2d> rst2;
0231   Adaptor3d_CurveOnSurface       cons1;
0232   Adaptor3d_CurveOnSurface       cons2;
0233   occ::handle<Adaptor3d_Curve>   guide;
0234   occ::handle<Adaptor3d_Curve>   tguide;
0235   gp_Pnt                         ptrst1;
0236   gp_Pnt                         ptrst2;
0237   gp_Pnt2d                       pt2drst1;
0238   gp_Pnt2d                       pt2drst2;
0239   double                         prmrst1;
0240   double                         prmrst2;
0241   bool                           istangent;
0242   gp_Vec                         tgrst1;
0243   gp_Vec2d                       tg2drst1;
0244   gp_Vec                         tgrst2;
0245   gp_Vec2d                       tg2drst2;
0246   double                         ray;
0247   int                            choix;
0248   gp_Pnt                         ptgui;
0249   gp_Vec                         d1gui;
0250   gp_Vec                         d2gui;
0251   gp_Vec                         nplan;
0252   double                         normtg;
0253   double                         theD;
0254   occ::handle<Adaptor3d_Surface> surfref1;
0255   occ::handle<Adaptor2d_Curve2d> rstref1;
0256   occ::handle<Adaptor3d_Surface> surfref2;
0257   occ::handle<Adaptor2d_Curve2d> rstref2;
0258   double                         maxang;
0259   double                         minang;
0260   double                         distmin;
0261   BlendFunc_SectionShape         mySShape;
0262   Convert_ParameterisationType   myTConv;
0263 };
0264 
0265 #endif // _BRepBlend_RstRstConstRad_HeaderFile