Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-29 09:18:18

0001 // Created on: 1993-04-14
0002 // Created by: Isabelle GRIGNON
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 _BRepGProp_Face_HeaderFile
0018 #define _BRepGProp_Face_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <BRepAdaptor_Surface.hxx>
0025 #include <Geom2dAdaptor_Curve.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <gp_Pnt2d.hxx>
0028 #include <NCollection_Array1.hxx>
0029 #include <GeomAbs_IsoType.hxx>
0030 #include <NCollection_HArray1.hxx>
0031 #include <TopLoc_Location.hxx>
0032 
0033 class TopoDS_Face;
0034 class gp_Pnt;
0035 class gp_Vec;
0036 class TopoDS_Edge;
0037 class gp_Pnt2d;
0038 class gp_Vec2d;
0039 class Geom_Surface;
0040 
0041 class BRepGProp_Face
0042 {
0043 public:
0044   DEFINE_STANDARD_ALLOC
0045 
0046   //! Constructor. Initializes the object with a flag IsUseSpan
0047   //! that says if it is necessary to define spans on a face.
0048   //! This option has an effect only for BSpline faces. Spans
0049   //! are returned by the methods GetUKnots and GetTKnots.
0050   BRepGProp_Face(const bool IsUseSpan = false);
0051 
0052   //! Constructor. Initializes the object with the face and the
0053   //! flag IsUseSpan that says if it is necessary to define
0054   //! spans on a face. This option has an effect only for
0055   //! BSpline faces. Spans are returned by the methods GetUKnots
0056   //! and GetTKnots.
0057   BRepGProp_Face(const TopoDS_Face& F, const bool IsUseSpan = false);
0058 
0059   Standard_EXPORT void Load(const TopoDS_Face& F);
0060 
0061   Standard_EXPORT int VIntegrationOrder() const;
0062 
0063   //! Returns true if the face is not trimmed.
0064   bool NaturalRestriction() const;
0065 
0066   //! Returns the TopoDS face.
0067   const TopoDS_Face& GetFace() const;
0068 
0069   //! Returns the value of the boundary curve of the face.
0070   gp_Pnt2d Value2d(const double U) const;
0071 
0072   Standard_EXPORT int SIntOrder(const double Eps) const;
0073 
0074   Standard_EXPORT int SVIntSubs() const;
0075 
0076   Standard_EXPORT int SUIntSubs() const;
0077 
0078   Standard_EXPORT void UKnots(NCollection_Array1<double>& Knots) const;
0079 
0080   Standard_EXPORT void VKnots(NCollection_Array1<double>& Knots) const;
0081 
0082   Standard_EXPORT int LIntOrder(const double Eps) const;
0083 
0084   Standard_EXPORT int LIntSubs() const;
0085 
0086   Standard_EXPORT void LKnots(NCollection_Array1<double>& Knots) const;
0087 
0088   //! Returns the number of points required to do the
0089   //! integration in the U parametric direction with
0090   //! a good accuracy.
0091   Standard_EXPORT int UIntegrationOrder() const;
0092 
0093   //! Returns the parametric bounds of the Face.
0094   Standard_EXPORT void Bounds(double& U1, double& U2, double& V1, double& V2) const;
0095 
0096   //! Computes the point of parameter U, V on the Face <S> and
0097   //! the normal to the face at this point.
0098   Standard_EXPORT void Normal(const double U, const double V, gp_Pnt& P, gp_Vec& VNor) const;
0099 
0100   //! Loading the boundary arc.
0101   //! Returns FALSE if edge has no P-Curve.
0102   Standard_EXPORT bool Load(const TopoDS_Edge& E);
0103 
0104   //! Returns the parametric value of the start point of
0105   //! the current arc of curve.
0106   double FirstParameter() const;
0107 
0108   //! Returns the parametric value of the end point of
0109   //! the current arc of curve.
0110   double LastParameter() const;
0111 
0112   //! Returns the number of points required to do the
0113   //! integration along the parameter of curve.
0114   Standard_EXPORT int IntegrationOrder() const;
0115 
0116   //! Returns the point of parameter U and the first derivative
0117   //! at this point of a boundary curve.
0118   void D12d(const double U, gp_Pnt2d& P, gp_Vec2d& V1) const;
0119 
0120   //! Loading the boundary arc. This arc is either a top, bottom,
0121   //! left or right bound of a UV rectangle in which the
0122   //! parameters of surface are defined.
0123   //! If IsFirstParam is equal to true, the face is
0124   //! initialized by either left of bottom bound. Otherwise it is
0125   //! initialized by the top or right one.
0126   //! If theIsoType is equal to GeomAbs_IsoU, the face is
0127   //! initialized with either left or right bound. Otherwise -
0128   //! with either top or bottom one.
0129   Standard_EXPORT void Load(const bool IsFirstParam, const GeomAbs_IsoType theIsoType);
0130 
0131   //! Returns an array of U knots of the face. The first and last
0132   //! elements of the array will be theUMin and theUMax. The
0133   //! middle elements will be the U Knots of the face greater
0134   //! then theUMin and lower then theUMax in increasing order.
0135   //! If the face is not a BSpline, the array initialized with
0136   //! theUMin and theUMax only.
0137   //! @param[in] theUMin lower U bound
0138   //! @param[in] theUMax upper U bound
0139   //! @return array of U knot values
0140   [[nodiscard]] Standard_EXPORT occ::handle<NCollection_HArray1<double>> GetUKnots(
0141     const double theUMin,
0142     const double theUMax) const;
0143 
0144   //! @deprecated Use GetUKnots() returning handle by value instead.
0145   Standard_DEPRECATED("Use GetUKnots() returning handle by value instead")
0146   Standard_EXPORT void GetUKnots(const double                              theUMin,
0147                                  const double                              theUMax,
0148                                  occ::handle<NCollection_HArray1<double>>& theUKnots) const;
0149 
0150   //! Returns an array of combination of T knots of the arc and
0151   //! V knots of the face. The first and last elements of the
0152   //! array will be theTMin and theTMax. The middle elements will
0153   //! be the Knots of the arc and the values of parameters of
0154   //! arc on which the value points have V coordinates close to V
0155   //! knots of face. All the parameter will be greater then
0156   //! theTMin and lower then theTMax in increasing order.
0157   //! If the face is not a BSpline, the array initialized with
0158   //! theTMin and theTMax only.
0159   //! @param[in] theTMin lower T bound
0160   //! @param[in] theTMax upper T bound
0161   //! @return array of T knot values
0162   [[nodiscard]] Standard_EXPORT occ::handle<NCollection_HArray1<double>> GetTKnots(
0163     const double theTMin,
0164     const double theTMax) const;
0165 
0166   //! @deprecated Use GetTKnots() returning handle by value instead.
0167   Standard_DEPRECATED("Use GetTKnots() returning handle by value instead")
0168   Standard_EXPORT void GetTKnots(const double                              theTMin,
0169                                  const double                              theTMax,
0170                                  occ::handle<NCollection_HArray1<double>>& theTKnots) const;
0171 
0172 private:
0173   BRepAdaptor_Surface       mySurface;
0174   Geom2dAdaptor_Curve       myCurve;
0175   occ::handle<Geom_Surface> myFaceSurface;
0176   TopLoc_Location           myFaceLocation;
0177   bool                      myIsFaceContextReady;
0178   bool                      mySReverse;
0179   bool                      myIsUseSpan;
0180 };
0181 
0182 #include <BRepGProp_Face.lxx>
0183 
0184 #endif // _BRepGProp_Face_HeaderFile