Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/BRepAdaptor_Surface.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Created on: 1993-02-22
0002 // Created by: Remi LEQUETTE
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 _BRepAdaptor_Surface_HeaderFile
0018 #define _BRepAdaptor_Surface_HeaderFile
0019 
0020 #include <GeomAdaptor_Surface.hxx>
0021 #include <GeomAbs_Shape.hxx>
0022 #include <GeomAbs_SurfaceType.hxx>
0023 #include <gp_Trsf.hxx>
0024 #include <TColStd_Array1OfReal.hxx>
0025 #include <TopoDS_Face.hxx>
0026 
0027 class gp_Pnt;
0028 class gp_Vec;
0029 class gp_Pln;
0030 class gp_Cylinder;
0031 class gp_Cone;
0032 class gp_Sphere;
0033 class gp_Torus;
0034 class Geom_BezierSurface;
0035 class Geom_BSplineSurface;
0036 class gp_Ax1;
0037 class gp_Dir;
0038 
0039 DEFINE_STANDARD_HANDLE(BRepAdaptor_Surface, Adaptor3d_Surface)
0040 
0041 //! The Surface from BRepAdaptor allows to  use a Face
0042 //! of the BRep topology look like a 3D surface.
0043 //!
0044 //! It  has  the methods  of  the class   Surface from
0045 //! Adaptor3d.
0046 //!
0047 //! It is created or initialized with a Face. It takes
0048 //! into account the local coordinates system.
0049 //!
0050 //! The  u,v parameter range is   the minmax value for
0051 //! the  restriction,  unless  the flag restriction is
0052 //! set to false.
0053 class BRepAdaptor_Surface  : public Adaptor3d_Surface
0054 {
0055   DEFINE_STANDARD_RTTIEXT(BRepAdaptor_Surface, Adaptor3d_Surface)
0056 public:
0057 
0058   //! Creates an undefined surface with no face loaded.
0059   Standard_EXPORT BRepAdaptor_Surface();
0060   
0061   //! Creates a surface to  access the geometry  of <F>.
0062   //! If  <Restriction> is  true  the parameter range is
0063   //! the  parameter  range  in   the  UV space  of  the
0064   //! restriction.
0065   Standard_EXPORT BRepAdaptor_Surface(const TopoDS_Face& F, const Standard_Boolean R = Standard_True);
0066 
0067   //! Shallow copy of adaptor
0068   Standard_EXPORT virtual Handle(Adaptor3d_Surface) ShallowCopy() const Standard_OVERRIDE;
0069   
0070   //! Sets the surface to the geometry of <F>.
0071   Standard_EXPORT void Initialize (const TopoDS_Face& F, const Standard_Boolean Restriction = Standard_True);
0072   
0073   //! Returns the surface.
0074   Standard_EXPORT const GeomAdaptor_Surface& Surface() const;
0075   
0076   //! Returns the surface.
0077   Standard_EXPORT GeomAdaptor_Surface& ChangeSurface();
0078   
0079   //! Returns the surface coordinate system.
0080   Standard_EXPORT const gp_Trsf& Trsf() const;
0081   
0082   //! Returns the face.
0083   Standard_EXPORT const TopoDS_Face& Face() const;
0084   
0085   //! Returns the face tolerance.
0086   Standard_EXPORT Standard_Real Tolerance() const;
0087 
0088   virtual Standard_Real FirstUParameter() const Standard_OVERRIDE { return mySurf.FirstUParameter(); }
0089 
0090   virtual Standard_Real LastUParameter() const Standard_OVERRIDE { return mySurf.LastUParameter(); }
0091 
0092   virtual Standard_Real FirstVParameter() const Standard_OVERRIDE { return mySurf.FirstVParameter(); }
0093 
0094   virtual Standard_Real LastVParameter() const Standard_OVERRIDE { return mySurf.LastVParameter(); }
0095 
0096   virtual GeomAbs_Shape UContinuity() const Standard_OVERRIDE { return mySurf.UContinuity(); }
0097 
0098   virtual GeomAbs_Shape VContinuity() const Standard_OVERRIDE { return mySurf.VContinuity(); }
0099   
0100   //! If necessary, breaks the surface in U intervals of
0101   //! continuity    <S>.  And   returns  the  number  of
0102   //! intervals.
0103   virtual Standard_Integer NbUIntervals (const GeomAbs_Shape theSh) const Standard_OVERRIDE { return mySurf.NbUIntervals (theSh); }
0104 
0105   //! If necessary, breaks the surface in V intervals of
0106   //! continuity    <S>.  And   returns  the  number  of
0107   //! intervals.
0108   virtual Standard_Integer NbVIntervals (const GeomAbs_Shape theSh) const Standard_OVERRIDE { return mySurf.NbVIntervals (theSh); }
0109   
0110   //! Returns the  intervals with the requested continuity
0111   //! in the U direction.
0112   Standard_EXPORT void UIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
0113   
0114   //! Returns the  intervals with the requested continuity
0115   //! in the V direction.
0116   Standard_EXPORT void VIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
0117   
0118   //! Returns    a  surface trimmed in the U direction
0119   //! equivalent   of  <me>  between
0120   //! parameters <First>  and <Last>. <Tol>  is used  to
0121   //! test for 3d points confusion.
0122   //! If <First> >= <Last>
0123   Standard_EXPORT Handle(Adaptor3d_Surface) UTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
0124   
0125   //! Returns    a  surface trimmed in the V direction  between
0126   //! parameters <First>  and <Last>. <Tol>  is used  to
0127   //! test for 3d points confusion.
0128   //! If <First> >= <Last>
0129   Standard_EXPORT Handle(Adaptor3d_Surface) VTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
0130 
0131   virtual Standard_Boolean IsUClosed() const Standard_OVERRIDE { return mySurf.IsUClosed(); }
0132 
0133   virtual Standard_Boolean IsVClosed() const Standard_OVERRIDE { return mySurf.IsVClosed(); }
0134 
0135   virtual Standard_Boolean IsUPeriodic() const Standard_OVERRIDE { return mySurf.IsUPeriodic(); }
0136 
0137   virtual Standard_Real UPeriod() const Standard_OVERRIDE { return mySurf.UPeriod(); }
0138 
0139   virtual Standard_Boolean IsVPeriodic() const Standard_OVERRIDE { return mySurf.IsVPeriodic(); }
0140 
0141   virtual Standard_Real VPeriod() const Standard_OVERRIDE { return mySurf.VPeriod(); }
0142 
0143   //! Computes the point of parameters U,V on the surface.
0144   //! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
0145   Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const Standard_OVERRIDE;
0146 
0147   //! Computes the point of parameters U,V on the surface.
0148   Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
0149 
0150   //! Computes the point  and the first derivatives on the surface.
0151   //! Raised if the continuity of the current intervals is not C1.
0152   //!
0153   //! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
0154   Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
0155 
0156   //! Computes   the point,  the  first  and  second
0157   //! derivatives on the surface.
0158   //! Raised  if   the   continuity   of the current
0159   //! intervals is not C2.
0160   Standard_EXPORT void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const Standard_OVERRIDE;
0161   
0162   //! Computes the point,  the first, second and third
0163   //! derivatives on the surface.
0164   //! Raised  if   the   continuity   of the current
0165   //! intervals is not C3.
0166   Standard_EXPORT void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const Standard_OVERRIDE;
0167   
0168   //! Computes the derivative of order Nu in the direction
0169   //! U and Nv in the direction V at the point P(U, V).
0170   //! Raised if the current U  interval is not not CNu
0171   //! and the current V interval is not CNv.
0172   //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
0173   Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
0174   
0175   //! Returns the parametric U  resolution corresponding
0176   //! to the real space resolution <R3d>.
0177   virtual Standard_Real UResolution (const Standard_Real theR3d) const Standard_OVERRIDE { return mySurf.UResolution (theR3d); }
0178   
0179   //! Returns the parametric V  resolution corresponding
0180   //! to the real space resolution <R3d>.
0181   virtual Standard_Real VResolution (const Standard_Real theR3d) const Standard_OVERRIDE { return mySurf.VResolution (theR3d); }
0182 
0183   //! Returns the type of the surface : Plane, Cylinder,
0184   //! Cone,      Sphere,        Torus,    BezierSurface,
0185   //! BSplineSurface,               SurfaceOfRevolution,
0186   //! SurfaceOfExtrusion, OtherSurface
0187   virtual GeomAbs_SurfaceType GetType() const Standard_OVERRIDE { return mySurf.GetType(); }
0188   
0189   Standard_EXPORT gp_Pln Plane() const Standard_OVERRIDE;
0190   
0191   Standard_EXPORT gp_Cylinder Cylinder() const Standard_OVERRIDE;
0192   
0193   Standard_EXPORT gp_Cone Cone() const Standard_OVERRIDE;
0194   
0195   Standard_EXPORT gp_Sphere Sphere() const Standard_OVERRIDE;
0196   
0197   Standard_EXPORT gp_Torus Torus() const Standard_OVERRIDE;
0198   
0199   virtual Standard_Integer UDegree() const Standard_OVERRIDE { return mySurf.UDegree(); }
0200 
0201   virtual Standard_Integer NbUPoles() const Standard_OVERRIDE { return mySurf.NbUPoles(); }
0202 
0203   virtual Standard_Integer VDegree() const Standard_OVERRIDE { return mySurf.VDegree(); }
0204 
0205   virtual Standard_Integer NbVPoles() const Standard_OVERRIDE { return mySurf.NbVPoles(); }
0206 
0207   virtual Standard_Integer NbUKnots() const Standard_OVERRIDE { return mySurf.NbUKnots(); }
0208 
0209   virtual Standard_Integer NbVKnots() const Standard_OVERRIDE { return mySurf.NbVKnots(); }
0210 
0211   virtual Standard_Boolean IsURational() const Standard_OVERRIDE { return mySurf.IsURational(); }
0212 
0213   virtual Standard_Boolean IsVRational() const Standard_OVERRIDE { return mySurf.IsVRational(); }
0214 
0215   Standard_EXPORT Handle(Geom_BezierSurface) Bezier() const Standard_OVERRIDE;
0216 
0217   //! Warning : this will make a copy of the
0218   //! BSpline Surface since it applies
0219   //! to it the myTsrf transformation
0220   //! Be Careful when using this method
0221   Standard_EXPORT Handle(Geom_BSplineSurface) BSpline() const Standard_OVERRIDE;
0222   
0223   Standard_EXPORT gp_Ax1 AxeOfRevolution() const Standard_OVERRIDE;
0224   
0225   Standard_EXPORT gp_Dir Direction() const Standard_OVERRIDE;
0226   
0227   //! only for SurfaceOfExtrusion and SurfaceOfRevolution
0228   //! Warning: this will make a copy of the underlying curve
0229   //! since it applies to it the transformation
0230   //! myTrsf. Be careful when using this method.
0231   Standard_EXPORT Handle(Adaptor3d_Curve) BasisCurve() const Standard_OVERRIDE;
0232   
0233   Standard_EXPORT Handle(Adaptor3d_Surface) BasisSurface() const Standard_OVERRIDE;
0234   
0235   Standard_EXPORT Standard_Real OffsetValue() const Standard_OVERRIDE;
0236 
0237 private:
0238 
0239   GeomAdaptor_Surface mySurf;
0240   gp_Trsf myTrsf;
0241   TopoDS_Face myFace;
0242 
0243 };
0244 
0245 #endif // _BRepAdaptor_Surface_HeaderFile