Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:17:53

0001 // Created on: 1993-04-14
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 _HLRBRep_Surface_HeaderFile
0018 #define _HLRBRep_Surface_HeaderFile
0019 
0020 #include <HLRBRep_Curve.hxx>
0021 
0022 #include <Standard.hxx>
0023 #include <Standard_DefineAlloc.hxx>
0024 
0025 #include <BRepAdaptor_Surface.hxx>
0026 #include <GeomAbs_SurfaceType.hxx>
0027 #include <gp_Pnt.hxx>
0028 #include <NCollection_Array2.hxx>
0029 #include <GeomAbs_Shape.hxx>
0030 #include <gp_Vec.hxx>
0031 #include <gp_Cylinder.hxx>
0032 #include <gp_Cone.hxx>
0033 #include <gp_Sphere.hxx>
0034 #include <gp_Torus.hxx>
0035 #include <gp_Ax1.hxx>
0036 class TopoDS_Face;
0037 class gp_Pnt;
0038 class gp_Vec;
0039 class gp_Pln;
0040 
0041 class HLRBRep_Surface
0042 {
0043 public:
0044   DEFINE_STANDARD_ALLOC
0045 
0046   //! Creates an undefined surface with no face loaded.
0047   Standard_EXPORT HLRBRep_Surface();
0048 
0049   void Projector(const HLRAlgo_Projector* Proj) { myProj = Proj; }
0050 
0051   //! Returns the 3D Surface.
0052   BRepAdaptor_Surface& Surface();
0053 
0054   //! Returns the 3D Surface (const version).
0055   const BRepAdaptor_Surface& Surface() const;
0056 
0057   //! Sets the 3D Surface to be projected.
0058   Standard_EXPORT void Surface(const TopoDS_Face& F);
0059 
0060   //! returns true if it is a side face
0061   Standard_EXPORT bool IsSide(const double tolf, const double toler) const;
0062 
0063   Standard_EXPORT bool IsAbove(const bool back, const HLRBRep_Curve* A, const double tolC) const;
0064 
0065   double FirstUParameter() const;
0066 
0067   double LastUParameter() const;
0068 
0069   double FirstVParameter() const;
0070 
0071   double LastVParameter() const;
0072 
0073   GeomAbs_Shape UContinuity() const;
0074 
0075   GeomAbs_Shape VContinuity() const;
0076 
0077   //! If necessary, breaks the surface in U intervals of
0078   //! continuity <S>. And returns the number of
0079   //! intervals.
0080   int NbUIntervals(const GeomAbs_Shape S) const;
0081 
0082   //! If necessary, breaks the surface in V intervals of
0083   //! continuity <S>. And returns the number of
0084   //! intervals.
0085   int NbVIntervals(const GeomAbs_Shape S) const;
0086 
0087   GeomAbs_Shape UIntervalContinuity() const;
0088 
0089   GeomAbs_Shape VIntervalContinuity() const;
0090 
0091   bool IsUClosed() const;
0092 
0093   bool IsVClosed() const;
0094 
0095   bool IsUPeriodic() const;
0096 
0097   double UPeriod() const;
0098 
0099   bool IsVPeriodic() const;
0100 
0101   double VPeriod() const;
0102 
0103   //! Computes the point of parameters U,V on the surface.
0104   Standard_EXPORT gp_Pnt Value(const double U, const double V) const;
0105 
0106   //! Computes the point of parameters U,V on the surface.
0107   void D0(const double U, const double V, gp_Pnt& P) const;
0108 
0109   //! Computes the point and the first derivatives on
0110   //! the surface.
0111   //! Raised if the continuity of the current
0112   //! intervals is not C1.
0113   void D1(const double U, const double V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
0114 
0115   //! Computes the point, the first and second
0116   //! derivatives on the surface.
0117   //! Raised if the continuity of the current
0118   //! intervals is not C2.
0119   void D2(const double U,
0120           const double V,
0121           gp_Pnt&      P,
0122           gp_Vec&      D1U,
0123           gp_Vec&      D1V,
0124           gp_Vec&      D2U,
0125           gp_Vec&      D2V,
0126           gp_Vec&      D2UV) const;
0127 
0128   //! Computes the point, the first, second and third
0129   //! derivatives on the surface.
0130   //! Raised if the continuity of the current
0131   //! intervals is not C3.
0132   void D3(const double U,
0133           const double V,
0134           gp_Pnt&      P,
0135           gp_Vec&      D1U,
0136           gp_Vec&      D1V,
0137           gp_Vec&      D2U,
0138           gp_Vec&      D2V,
0139           gp_Vec&      D2UV,
0140           gp_Vec&      D3U,
0141           gp_Vec&      D3V,
0142           gp_Vec&      D3UUV,
0143           gp_Vec&      D3UVV) const;
0144 
0145   //! Computes the derivative of order Nu in the
0146   //! direction U and Nv in the direction V at the point P(U,
0147   //! V).
0148   //! Raised if the current U interval is not not CNu
0149   //! and the current V interval is not CNv.
0150   //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
0151   gp_Vec DN(const double U, const double V, const int Nu, const int Nv) const;
0152 
0153   //! Returns the type of the surface : Plane, Cylinder,
0154   //! Cone, Sphere, Torus, BezierSurface,
0155   //! BSplineSurface, SurfaceOfRevolution,
0156   //! SurfaceOfExtrusion, OtherSurface
0157   GeomAbs_SurfaceType GetType() const;
0158 
0159   Standard_EXPORT gp_Pln Plane() const;
0160 
0161   gp_Cylinder Cylinder() const;
0162 
0163   gp_Cone Cone() const;
0164 
0165   gp_Sphere Sphere() const;
0166 
0167   gp_Torus Torus() const;
0168 
0169   int UDegree() const;
0170 
0171   int NbUPoles() const;
0172 
0173   int VDegree() const;
0174 
0175   int NbVPoles() const;
0176 
0177   int NbUKnots() const;
0178 
0179   int NbVKnots() const;
0180 
0181   gp_Ax1 Axis() const;
0182 
0183 private:
0184   //! returns true if it is a side face
0185   Standard_EXPORT bool SideRowsOfPoles(const double                tol,
0186                                        const int                   nbuPoles,
0187                                        const int                   nbvPoles,
0188                                        NCollection_Array2<gp_Pnt>& Pnt) const;
0189 
0190   BRepAdaptor_Surface      mySurf;
0191   GeomAbs_SurfaceType      myType;
0192   const HLRAlgo_Projector* myProj;
0193 };
0194 
0195 #include <HLRBRep_Surface.lxx>
0196 
0197 #endif // _HLRBRep_Surface_HeaderFile