Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:46

0001 // Created on: 1992-02-14
0002 // Created by: Jean Claude VAUTHIER
0003 // Copyright (c) 1992-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 _GProp_PGProps_HeaderFile
0018 #define _GProp_PGProps_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <GProp_GProps.hxx>
0025 #include <TColgp_Array1OfPnt.hxx>
0026 #include <TColgp_Array2OfPnt.hxx>
0027 #include <TColStd_Array1OfReal.hxx>
0028 #include <TColStd_Array2OfReal.hxx>
0029 class gp_Pnt;
0030 
0031 
0032 //! A framework for computing the global properties of a
0033 //! set of points.
0034 //! A point mass is attached to each point. The global
0035 //! mass of the system is the sum of each individual
0036 //! mass. By default, the point mass is equal to 1 and the
0037 //! mass of a system composed of N points is equal to N.
0038 //! Warning
0039 //! A framework of this sort provides functions to handle
0040 //! sets of points easily. But, like any GProp_GProps
0041 //! object, by using the Add function, it can theoretically
0042 //! bring together the computed global properties and
0043 //! those of a system more complex than a set of points .
0044 //! The mass of each point and the density of each
0045 //! component of the composed system must be
0046 //! coherent. Note that this coherence cannot be checked.
0047 //! Nonetheless, you are advised to restrict your use of a
0048 //! GProp_PGProps object to a set of points and to
0049 //! create a GProp_GProps object in order to bring
0050 //! together global properties of different systems.
0051 class GProp_PGProps  : public GProp_GProps
0052 {
0053 public:
0054 
0055   DEFINE_STANDARD_ALLOC
0056 
0057   
0058   //! Initializes a framework to compute global properties
0059   //! on a set of points.
0060   //! The point relative to which the inertia of the system is
0061   //! computed will be the origin (0, 0, 0) of the
0062   //! absolute Cartesian coordinate system.
0063   //! At initialization, the framework is empty, i.e. it retains
0064   //! no dimensional information such as mass and inertia.
0065   //! It is, however, now able to keep global properties of a
0066   //! set of points while new points are added using the
0067   //! AddPoint function.
0068   //! The set of points whose global properties are brought
0069   //! together by this framework will then be referred to as
0070   //! the current system. The current system is, however,
0071   //! not kept by this framework, which only keeps that
0072   //! system's global properties. Note that the current
0073   //! system may be more complex than a set of points.
0074   Standard_EXPORT GProp_PGProps();
0075   
0076   //! Brings together the global properties already
0077   //! retained by this framework with those induced by
0078   //! the point Pnt. Pnt may be the first point of the current system.
0079   //! A point mass is attached to the point Pnt, it is either
0080   //! equal to 1. or to Density.
0081   Standard_EXPORT void AddPoint (const gp_Pnt& P);
0082   
0083 
0084   //! Adds a new point P with its density in the system of points
0085   //! Exceptions
0086   //! Standard_DomainError if the mass value Density
0087   //! is less than gp::Resolution().
0088   Standard_EXPORT void AddPoint (const gp_Pnt& P, const Standard_Real Density);
0089   
0090 
0091   //! computes the global properties of the system of points Pnts.
0092   //! The density of the points are defaulted to all being 1
0093   Standard_EXPORT GProp_PGProps(const TColgp_Array1OfPnt& Pnts);
0094   
0095 
0096   //! computes the global properties of the system of points Pnts.
0097   //! The density of the points are defaulted to all being 1
0098   Standard_EXPORT GProp_PGProps(const TColgp_Array2OfPnt& Pnts);
0099   
0100 
0101   //! computes the global properties of the system of points Pnts.
0102   //! A density is associated with each point.
0103   //!
0104   //! raises if a density is lower or equal to Resolution from package
0105   //! gp.
0106   //!
0107   //! raises if the length of Pnts and the length of Density
0108   //! is not the same.
0109   Standard_EXPORT GProp_PGProps(const TColgp_Array1OfPnt& Pnts, const TColStd_Array1OfReal& Density);
0110   
0111 
0112   //! computes the global properties of the system of points Pnts.
0113   //! A density is associated with each point.
0114   //!
0115   //! Raised if a density is lower or equal to Resolution from package
0116   //! gp.
0117   //!
0118   //! Raised if the length of Pnts and the length of Density
0119   //! is not the same.
0120   Standard_EXPORT GProp_PGProps(const TColgp_Array2OfPnt& Pnts, const TColStd_Array2OfReal& Density);
0121   
0122 
0123   //! Computes the barycentre of a set of points. The density of the
0124   //! points is defaulted to 1.
0125   Standard_EXPORT static gp_Pnt Barycentre (const TColgp_Array1OfPnt& Pnts);
0126   
0127 
0128   //! Computes the barycentre of a set of points. The density of the
0129   //! points is defaulted to 1.
0130   Standard_EXPORT static gp_Pnt Barycentre (const TColgp_Array2OfPnt& Pnts);
0131   
0132 
0133   //! Computes the barycentre of a set of points. A density is associated
0134   //! with each point.
0135   //!
0136   //! raises if a density is lower or equal to Resolution from package
0137   //! gp.
0138   //!
0139   //! Raised if the length of Pnts and the length of Density
0140   //! is not the same.
0141   Standard_EXPORT static void Barycentre (const TColgp_Array1OfPnt& Pnts, const TColStd_Array1OfReal& Density, Standard_Real& Mass, gp_Pnt& G);
0142   
0143 
0144   //! Computes the barycentre of a set of points. A density is associated
0145   //! with each point.
0146   //!
0147   //! Raised if a density is lower or equal to Resolution from package
0148   //! gp.
0149   //!
0150   //! Raised if the length of Pnts and the length of Density
0151   //! is not the same.
0152   Standard_EXPORT static void Barycentre (const TColgp_Array2OfPnt& Pnts, const TColStd_Array2OfReal& Density, Standard_Real& Mass, gp_Pnt& G);
0153 
0154 
0155 
0156 
0157 protected:
0158 
0159 
0160 
0161 
0162 
0163 private:
0164 
0165 
0166 
0167 
0168 
0169 };
0170 
0171 
0172 
0173 
0174 
0175 
0176 
0177 #endif // _GProp_PGProps_HeaderFile