Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-25 08:29:12

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