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>
33 //! A framework for computing the global properties of a
35 //! A point mass is attached to each point. The global
36 //! mass of the system is the sum of each individual
37 //! mass. By default, the point mass is equal to 1 and the
38 //! mass of a system composed of N points is equal to N.
40 //! A framework of this sort provides functions to handle
41 //! sets of points easily. But, like any GProp_GProps
42 //! object, by using the Add function, it can theoretically
43 //! bring together the computed global properties and
44 //! those of a system more complex than a set of points .
45 //! The mass of each point and the density of each
46 //! component of the composed system must be
47 //! coherent. Note that this coherence cannot be checked.
48 //! Nonetheless, you are advised to restrict your use of a
49 //! GProp_PGProps object to a set of points and to
50 //! create a GProp_GProps object in order to bring
51 //! together global properties of different systems.
52 class GProp_PGProps : public GProp_GProps
59 //! Initializes a framework to compute global properties
60 //! on a set of points.
61 //! The point relative to which the inertia of the system is
62 //! computed will be the origin (0, 0, 0) of the
63 //! absolute Cartesian coordinate system.
64 //! At initialization, the framework is empty, i.e. it retains
65 //! no dimensional information such as mass and inertia.
66 //! It is, however, now able to keep global properties of a
67 //! set of points while new points are added using the
68 //! AddPoint function.
69 //! The set of points whose global properties are brought
70 //! together by this framework will then be referred to as
71 //! the current system. The current system is, however,
72 //! not kept by this framework, which only keeps that
73 //! system's global properties. Note that the current
74 //! system may be more complex than a set of points.
75 Standard_EXPORT GProp_PGProps();
77 //! Brings together the global properties already
78 //! retained by this framework with those induced by
79 //! the point Pnt. Pnt may be the first point of the current system.
80 //! A point mass is attached to the point Pnt, it is either
81 //! equal to 1. or to Density.
82 Standard_EXPORT void AddPoint (const gp_Pnt& P);
85 //! Adds a new point P with its density in the system of points
87 //! Standard_DomainError if the mass value Density
88 //! is less than gp::Resolution().
89 Standard_EXPORT void AddPoint (const gp_Pnt& P, const Standard_Real Density);
92 //! computes the global properties of the system of points Pnts.
93 //! The density of the points are defaulted to all being 1
94 Standard_EXPORT GProp_PGProps(const TColgp_Array1OfPnt& Pnts);
97 //! computes the global properties of the system of points Pnts.
98 //! The density of the points are defaulted to all being 1
99 Standard_EXPORT GProp_PGProps(const TColgp_Array2OfPnt& Pnts);
102 //! computes the global properties of the system of points Pnts.
103 //! A density is associated with each point.
105 //! raises if a density is lower or equal to Resolution from package
108 //! raises if the length of Pnts and the length of Density
110 Standard_EXPORT GProp_PGProps(const TColgp_Array1OfPnt& Pnts, const TColStd_Array1OfReal& Density);
113 //! computes the global properties of the system of points Pnts.
114 //! A density is associated with each point.
116 //! Raised if a density is lower or equal to Resolution from package
119 //! Raised if the length of Pnts and the length of Density
121 Standard_EXPORT GProp_PGProps(const TColgp_Array2OfPnt& Pnts, const TColStd_Array2OfReal& Density);
124 //! Computes the barycentre of a set of points. The density of the
125 //! points is defaulted to 1.
126 Standard_EXPORT static gp_Pnt Barycentre (const TColgp_Array1OfPnt& Pnts);
129 //! Computes the barycentre of a set of points. The density of the
130 //! points is defaulted to 1.
131 Standard_EXPORT static gp_Pnt Barycentre (const TColgp_Array2OfPnt& Pnts);
134 //! Computes the barycentre of a set of points. A density is associated
137 //! raises if a density is lower or equal to Resolution from package
140 //! Raised if the length of Pnts and the length of Density
142 Standard_EXPORT static void Barycentre (const TColgp_Array1OfPnt& Pnts, const TColStd_Array1OfReal& Density, Standard_Real& Mass, gp_Pnt& G);
145 //! Computes the barycentre of a set of points. A density is associated
148 //! Raised if a density is lower or equal to Resolution from package
151 //! Raised if the length of Pnts and the length of Density
153 Standard_EXPORT static void Barycentre (const TColgp_Array2OfPnt& Pnts, const TColStd_Array2OfReal& Density, Standard_Real& Mass, gp_Pnt& G);
178 #endif // _GProp_PGProps_HeaderFile