1 // Created on: 1992-02-14
2 // Created by: Jean Claude VAUTHIER
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _GProp_PGProps_HeaderFile
18 #define _GProp_PGProps_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <GProp_GProps.hxx>
25 #include <Standard_Real.hxx>
26 #include <TColgp_Array1OfPnt.hxx>
27 #include <TColgp_Array2OfPnt.hxx>
28 #include <TColStd_Array1OfReal.hxx>
29 #include <TColStd_Array2OfReal.hxx>
30 class Standard_DimensionError;
31 class Standard_DomainError;
35 //! A framework for computing the global properties of a
37 //! A point mass is attached to each point. The global
38 //! mass of the system is the sum of each individual
39 //! mass. By default, the point mass is equal to 1 and the
40 //! mass of a system composed of N points is equal to N.
42 //! A framework of this sort provides functions to handle
43 //! sets of points easily. But, like any GProp_GProps
44 //! object, by using the Add function, it can theoretically
45 //! bring together the computed global properties and
46 //! those of a system more complex than a set of points .
47 //! The mass of each point and the density of each
48 //! component of the composed system must be
49 //! coherent. Note that this coherence cannot be checked.
50 //! Nonetheless, you are advised to restrict your use of a
51 //! GProp_PGProps object to a set of points and to
52 //! create a GProp_GProps object in order to bring
53 //! together global properties of different systems.
54 class GProp_PGProps : public GProp_GProps
61 //! Initializes a framework to compute global properties
62 //! on a set of points.
63 //! The point relative to which the inertia of the system is
64 //! computed will be the origin (0, 0, 0) of the
65 //! absolute Cartesian coordinate system.
66 //! At initialization, the framework is empty, i.e. it retains
67 //! no dimensional information such as mass and inertia.
68 //! It is, however, now able to keep global properties of a
69 //! set of points while new points are added using the
70 //! AddPoint function.
71 //! The set of points whose global properties are brought
72 //! together by this framework will then be referred to as
73 //! the current system. The current system is, however,
74 //! not kept by this framework, which only keeps that
75 //! system's global properties. Note that the current
76 //! system may be more complex than a set of points.
77 Standard_EXPORT GProp_PGProps();
79 //! Brings together the global properties already
80 //! retained by this framework with those induced by
81 //! the point Pnt. Pnt may be the first point of the current system.
82 //! A point mass is attached to the point Pnt, it is either
83 //! equal to 1. or to Density.
84 Standard_EXPORT void AddPoint (const gp_Pnt& P);
87 //! Adds a new point P with its density in the system of points
89 //! Standard_DomainError if the mass value Density
90 //! is less than gp::Resolution().
91 Standard_EXPORT void AddPoint (const gp_Pnt& P, const Standard_Real Density);
94 //! computes the global properties of the system of points Pnts.
95 //! The density of the points are defaulted to all being 1
96 Standard_EXPORT GProp_PGProps(const TColgp_Array1OfPnt& Pnts);
99 //! computes the global properties of the system of points Pnts.
100 //! The density of the points are defaulted to all being 1
101 Standard_EXPORT GProp_PGProps(const TColgp_Array2OfPnt& Pnts);
104 //! computes the global properties of the system of points Pnts.
105 //! A density is associated with each point.
107 //! raises if a density is lower or equal to Resolution from package
110 //! raises if the length of Pnts and the length of Density
112 Standard_EXPORT GProp_PGProps(const TColgp_Array1OfPnt& Pnts, const TColStd_Array1OfReal& Density);
115 //! computes the global properties of the system of points Pnts.
116 //! A density is associated with each point.
118 //! Raised if a density is lower or equal to Resolution from package
121 //! Raised if the length of Pnts and the length of Density
123 Standard_EXPORT GProp_PGProps(const TColgp_Array2OfPnt& Pnts, const TColStd_Array2OfReal& Density);
126 //! Computes the barycentre of a set of points. The density of the
127 //! points is defaulted to 1.
128 Standard_EXPORT static gp_Pnt Barycentre (const TColgp_Array1OfPnt& Pnts);
131 //! Computes the barycentre of a set of points. The density of the
132 //! points is defaulted to 1.
133 Standard_EXPORT static gp_Pnt Barycentre (const TColgp_Array2OfPnt& Pnts);
136 //! Computes the barycentre of a set of points. A density is associated
139 //! raises if a density is lower or equal to Resolution from package
142 //! Raised if the length of Pnts and the length of Density
144 Standard_EXPORT static void Barycentre (const TColgp_Array1OfPnt& Pnts, const TColStd_Array1OfReal& Density, Standard_Real& Mass, gp_Pnt& G);
147 //! Computes the barycentre of a set of points. A density is associated
150 //! Raised if a density is lower or equal to Resolution from package
153 //! Raised if the length of Pnts and the length of Density
155 Standard_EXPORT static void Barycentre (const TColgp_Array2OfPnt& Pnts, const TColStd_Array2OfReal& Density, Standard_Real& Mass, gp_Pnt& G);
180 #endif // _GProp_PGProps_HeaderFile