Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:52

0001 // Created on: 1993-02-22
0002 // Created by: Modelistation
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 _Adaptor3d_CurveOnSurface_HeaderFile
0018 #define _Adaptor3d_CurveOnSurface_HeaderFile
0019 
0020 #include <Adaptor2d_Curve2d.hxx>
0021 #include <Adaptor3d_Surface.hxx>
0022 #include <GeomAbs_CurveType.hxx>
0023 #include <GeomAbs_Shape.hxx>
0024 #include <TColStd_Array1OfReal.hxx>
0025 #include <TColStd_HSequenceOfReal.hxx>
0026 
0027 DEFINE_STANDARD_HANDLE(Adaptor3d_CurveOnSurface, Adaptor3d_Curve)
0028 
0029 //! An interface between the services provided by a curve
0030 //! lying on a surface from the package Geom and those
0031 //! required of the curve by algorithms which use it. The
0032 //! curve is defined as a 2D curve from the Geom2d
0033 //! package, in the parametric space of the surface.
0034 class Adaptor3d_CurveOnSurface  : public Adaptor3d_Curve
0035 {
0036   DEFINE_STANDARD_RTTIEXT(Adaptor3d_CurveOnSurface, Adaptor3d_Curve)
0037 public:
0038 
0039   Standard_EXPORT Adaptor3d_CurveOnSurface();
0040   
0041   Standard_EXPORT Adaptor3d_CurveOnSurface(const Handle(Adaptor3d_Surface)& S);
0042   
0043   //! Creates a CurveOnSurface from the 2d curve <C> and
0044   //! the surface <S>.
0045   Standard_EXPORT Adaptor3d_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& C, const Handle(Adaptor3d_Surface)& S);
0046   
0047   //! Shallow copy of adaptor
0048   Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE;
0049 
0050   //! Changes the surface.
0051   Standard_EXPORT void Load (const Handle(Adaptor3d_Surface)& S);
0052   
0053   //! Changes the 2d curve.
0054   Standard_EXPORT void Load (const Handle(Adaptor2d_Curve2d)& C);
0055   
0056   //! Load both curve and surface.
0057   Standard_EXPORT void Load (const Handle(Adaptor2d_Curve2d)& C, const Handle(Adaptor3d_Surface)& S);
0058   
0059   Standard_EXPORT const Handle(Adaptor2d_Curve2d)& GetCurve() const;
0060   
0061   Standard_EXPORT const Handle(Adaptor3d_Surface)& GetSurface() const;
0062   
0063   Standard_EXPORT Handle(Adaptor2d_Curve2d)& ChangeCurve();
0064   
0065   Standard_EXPORT Handle(Adaptor3d_Surface)& ChangeSurface();
0066   
0067   Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
0068   
0069   Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
0070   
0071   Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
0072   
0073   //! Returns  the number  of  intervals for  continuity
0074   //! <S>. May be one if Continuity(me) >= <S>
0075   Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
0076   
0077   //! Stores in <T> the  parameters bounding the intervals
0078   //! of continuity <S>.
0079   //!
0080   //! The array must provide  enough room to  accommodate
0081   //! for the parameters. i.e. T.Length() > NbIntervals()
0082   Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
0083   
0084   //! Returns    a  curve equivalent   of  <me>  between
0085   //! parameters <First>  and <Last>. <Tol>  is used  to
0086   //! test for 3d points confusion.
0087   //! If <First> >= <Last>
0088   Standard_EXPORT Handle(Adaptor3d_Curve) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
0089   
0090   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
0091   
0092   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
0093   
0094   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
0095   
0096   //! Computes the point of parameter U on the curve.
0097   Standard_EXPORT gp_Pnt Value (const Standard_Real U) const Standard_OVERRIDE;
0098   
0099   //! Computes the point of parameter U on the curve.
0100   Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE;
0101   
0102   //! Computes the point of parameter U on the curve with its
0103   //! first derivative.
0104   //! Raised if the continuity of the current interval
0105   //! is not C1.
0106   Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V) const Standard_OVERRIDE;
0107   
0108 
0109   //! Returns the point P of parameter U, the first and second
0110   //! derivatives V1 and V2.
0111   //! Raised if the continuity of the current interval
0112   //! is not C2.
0113   Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const Standard_OVERRIDE;
0114   
0115 
0116   //! Returns the point P of parameter U, the first, the second
0117   //! and the third derivative.
0118   //! Raised if the continuity of the current interval
0119   //! is not C3.
0120   Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const Standard_OVERRIDE;
0121   
0122 
0123   //! The returned vector gives the value of the derivative for the
0124   //! order of derivation N.
0125   //! Raised if the continuity of the current interval
0126   //! is not CN.
0127   //! Raised if N < 1.
0128   Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
0129   
0130   //! Returns the parametric  resolution corresponding
0131   //! to the real space resolution <R3d>.
0132   Standard_EXPORT Standard_Real Resolution (const Standard_Real R3d) const Standard_OVERRIDE;
0133   
0134   //! Returns  the  type of the   curve  in the  current
0135   //! interval :   Line,   Circle,   Ellipse, Hyperbola,
0136   //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
0137   Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE;
0138   
0139   Standard_EXPORT gp_Lin Line() const Standard_OVERRIDE;
0140   
0141   Standard_EXPORT gp_Circ Circle() const Standard_OVERRIDE;
0142   
0143   Standard_EXPORT gp_Elips Ellipse() const Standard_OVERRIDE;
0144   
0145   Standard_EXPORT gp_Hypr Hyperbola() const Standard_OVERRIDE;
0146   
0147   Standard_EXPORT gp_Parab Parabola() const Standard_OVERRIDE;
0148   
0149   Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE;
0150   
0151   Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE;
0152   
0153   Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE;
0154   
0155   Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE;
0156   
0157   Standard_EXPORT Handle(Geom_BezierCurve) Bezier() const Standard_OVERRIDE;
0158   
0159   Standard_EXPORT Handle(Geom_BSplineCurve) BSpline() const Standard_OVERRIDE;
0160 
0161 private:
0162   
0163   Standard_EXPORT void EvalKPart();
0164   
0165   //! Evaluates  myFirstSurf and myLastSurf
0166   //! for trimming the curve on surface.
0167   //! Following  methods  output left-bottom and right-top points
0168   //! of located part on surface
0169   //! for trimming the curve on surface.
0170   Standard_EXPORT void EvalFirstLastSurf();
0171   
0172   Standard_EXPORT void LocatePart (const gp_Pnt2d& UV, const gp_Vec2d& DUV, const Handle(Adaptor3d_Surface)& S, gp_Pnt2d& LeftBot, gp_Pnt2d& RightTop) const;
0173   
0174   Standard_EXPORT Standard_Boolean LocatePart_RevExt (const gp_Pnt2d& UV, const gp_Vec2d& DUV, const Handle(Adaptor3d_Surface)& S, gp_Pnt2d& LeftBot, gp_Pnt2d& RightTop) const;
0175   
0176   Standard_EXPORT Standard_Boolean LocatePart_Offset (const gp_Pnt2d& UV, const gp_Vec2d& DUV, const Handle(Adaptor3d_Surface)& S, gp_Pnt2d& LeftBot, gp_Pnt2d& RightTop) const;
0177   
0178   //! Extracts the numbers of knots which equal
0179   //! the point and checks derivative components
0180   //! by  zero equivalence.
0181   Standard_EXPORT void FindBounds (const TColStd_Array1OfReal& Arr, const Standard_Real XYComp, const Standard_Real DUVComp, Standard_Integer& Bnd1, Standard_Integer& Bnd2, Standard_Boolean& DerIsNull) const;
0182 
0183 private:
0184 
0185   Handle(Adaptor3d_Surface) mySurface;
0186   Handle(Adaptor2d_Curve2d) myCurve;
0187   GeomAbs_CurveType myType;
0188   gp_Circ myCirc;
0189   gp_Lin myLin;
0190   Handle(Adaptor3d_Surface) myFirstSurf;
0191   Handle(Adaptor3d_Surface) myLastSurf;
0192   Handle(TColStd_HSequenceOfReal) myIntervals;
0193   GeomAbs_Shape myIntCont;
0194 
0195 };
0196 
0197 #endif // _Adaptor3d_CurveOnSurface_HeaderFile