Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:16:43

0001 // Created on: 2005-12-21
0002 // Created by: Sergey KHROMOV
0003 // Copyright (c) 2005-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _BRepGProp_UFunction_HeaderFile
0017 #define _BRepGProp_UFunction_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <BRepGProp_Face.hxx>
0024 #include <gp_Pnt.hxx>
0025 #include <GProp_ValueType.hxx>
0026 #include <Standard_Boolean.hxx>
0027 #include <math_Function.hxx>
0028 class gp_XYZ;
0029 
0030 //! This class represents the integrand function for
0031 //! computation of an inner integral. The returned value
0032 //! depends on the value type and the flag IsByPoint.
0033 //!
0034 //! The type of returned value is the one of the following
0035 //! values:
0036 //! -  GProp_Mass - volume computation.
0037 //! -  GProp_CenterMassX, GProp_CenterMassY,
0038 //! GProp_CenterMassZ - X, Y and Z coordinates of center
0039 //! of mass computation.
0040 //! -  GProp_InertiaXX, GProp_InertiaYY, GProp_InertiaZZ,
0041 //! GProp_InertiaXY, GProp_InertiaXZ, GProp_InertiaYZ
0042 //! - moments of inertia computation.
0043 //!
0044 //! If the flag IsByPoint is set to true, the value is
0045 //! returned for the region of space that is delimited by a
0046 //! surface and a point. Otherwise all computations are
0047 //! performed for the region of space delimited by a surface
0048 //! and a plane.
0049 class BRepGProp_UFunction : public math_Function
0050 {
0051 public:
0052   DEFINE_STANDARD_ALLOC
0053 
0054   //! Constructor. Initializes the function with the face, the
0055   //! location point, the flag IsByPoint and the coefficients
0056   //! theCoeff that have different meaning depending on the value
0057   //! of IsByPoint.
0058   //! If IsByPoint is equal to true, the number of the
0059   //! coefficients is equal to 3 and they represent X, Y and Z
0060   //! coordinates (theCoeff[0], theCoeff[1] and theCoeff[2]
0061   //! correspondingly) of the shift, if the inertia is computed
0062   //! with respect to the point different then the location.
0063   //! If IsByPoint is equal to false, the number of the
0064   //! coefficients is 4 and they represent the combination of
0065   //! plane parameters and shift values.
0066   Standard_EXPORT BRepGProp_UFunction(const BRepGProp_Face& theSurface,
0067                                       const gp_Pnt&         theVertex,
0068                                       const bool            IsByPoint,
0069                                       const double*         theCoeffs);
0070 
0071   //! Setting the type of the value to be returned.
0072   void SetValueType(const GProp_ValueType theType);
0073 
0074   //! Setting the V parameter that is constant during the
0075   //! integral computation.
0076   void SetVParam(const double theVParam);
0077 
0078   //! Returns a value of the function.
0079   Standard_EXPORT bool Value(const double X, double& F) override;
0080 
0081 private:
0082   //! Private method. Returns the value for volume computation.
0083   //! Other returned values are:
0084   //! -  thePMP0 - PSurf(X,Y) minus Location.
0085   //! -  theS and theD1 coefficients that are computed and used
0086   //! for computation of center of mass and inertia values
0087   //! by plane.
0088   Standard_EXPORT double VolumeValue(const double X, gp_XYZ& thePMP0, double& theS, double& theD1);
0089 
0090   //! Private method. Returns a value for the center of mass
0091   //! computation. If the value type other then GProp_CenterMassX,
0092   //! GProp_CenterMassY or GProp_CenterMassZ this method returns
0093   //! false. Returns true in case of successful
0094   //! computation of a value.
0095   Standard_EXPORT bool CenterMassValue(const double X, double& F);
0096 
0097   //! Private method. Computes the value of inertia. The type of
0098   //! a value returned is defined by the value type. If it is
0099   //! other then GProp_InertiaXX, GProp_InertiaYY,
0100   //! GProp_InertiaZZ, GProp_InertiaXY, GProp_InertiaXZ or
0101   //! GProp_InertiaYZ, the method returns false. Returns
0102   //! true in case of successful computation of a value
0103   Standard_EXPORT bool InertiaValue(const double X, double& F);
0104 
0105   BRepGProp_Face  mySurface;
0106   gp_Pnt          myVertex;
0107   const double*   myCoeffs;
0108   double          myVParam;
0109   GProp_ValueType myValueType;
0110   bool            myIsByPoint;
0111 };
0112 
0113 #include <BRepGProp_UFunction.lxx>
0114 
0115 #endif // _BRepGProp_UFunction_HeaderFile