7fd59977 |
1 | -- File: PGProps.cdl |
2 | -- Created: Fri Feb 14 07:30:21 1992 |
3 | -- Author: Jean Claude VAUTHIER |
4 | ---Copyright: Matra Datavision 1992 |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | class PGProps |
12 | |
13 | from GProp |
14 | |
15 | inherits GProps |
16 | ---Purpose: A framework for computing the global properties of a |
17 | -- set of points. |
18 | -- A point mass is attached to each point. The global |
19 | -- mass of the system is the sum of each individual |
20 | -- mass. By default, the point mass is equal to 1 and the |
21 | -- mass of a system composed of N points is equal to N. |
22 | -- Warning |
23 | -- A framework of this sort provides functions to handle |
24 | -- sets of points easily. But, like any GProp_GProps |
25 | -- object, by using the Add function, it can theoretically |
26 | -- bring together the computed global properties and |
27 | -- those of a system more complex than a set of points . |
28 | -- The mass of each point and the density of each |
29 | -- component of the composed system must be |
30 | -- coherent. Note that this coherence cannot be checked. |
31 | -- Nonetheless, you are advised to restrict your use of a |
32 | -- GProp_PGProps object to a set of points and to |
33 | -- create a GProp_GProps object in order to bring |
34 | -- together global properties of different systems. |
35 | |
36 | uses Pnt from gp, |
37 | Array1OfPnt from TColgp, |
38 | Array2OfPnt from TColgp, |
39 | Array1OfReal from TColStd, |
40 | Array2OfReal from TColStd |
41 | |
42 | |
43 | raises DimensionError from Standard, |
44 | DomainError from Standard |
45 | |
46 | is |
47 | |
48 | Create returns PGProps; |
49 | --- Purpose : Initializes a framework to compute global properties |
50 | -- on a set of points. |
51 | -- The point relative to which the inertia of the system is |
52 | -- computed will be the origin (0, 0, 0) of the |
53 | -- absolute Cartesian coordinate system. |
54 | -- At initialization, the framework is empty, i.e. it retains |
55 | -- no dimensional information such as mass and inertia. |
56 | -- It is, however, now able to keep global properties of a |
57 | -- set of points while new points are added using the |
58 | -- AddPoint function. |
59 | -- The set of points whose global properties are brought |
60 | -- together by this framework will then be referred to as |
61 | -- the current system. The current system is, however, |
62 | -- not kept by this framework, which only keeps that |
63 | -- system's global properties. Note that the current |
64 | -- system may be more complex than a set of points. |
65 | |
66 | |
67 | AddPoint (me : in out; P : Pnt) |
68 | --- Purpose : Brings together the global properties already |
69 | -- retained by this framework with those induced by |
70 | -- the point Pnt. Pnt may be the first point of the current system. |
71 | -- A point mass is attached to the point Pnt, it is either |
72 | -- equal to 1. or to Density. |
73 | is static; |
74 | |
75 | |
76 | AddPoint (me : in out; P : Pnt; Density : Real) |
77 | --- Purpose : |
78 | -- Adds a new point P with its density in the system of points |
79 | -- Exceptions |
80 | -- Standard_DomainError if the mass value Density |
81 | -- is less than gp::Resolution(). |
82 | raises DomainError |
83 | is static; |
84 | |
85 | |
86 | Create (Pnts : Array1OfPnt) returns PGProps; |
87 | --- Purpose : |
88 | -- computes the global properties of the system of points Pnts. |
89 | -- The density of the points are defaulted to all being 1 |
90 | |
91 | |
92 | Create (Pnts : Array2OfPnt) returns PGProps; |
93 | --- Purpose : |
94 | -- computes the global properties of the system of points Pnts. |
95 | -- The density of the points are defaulted to all being 1 |
96 | |
97 | |
98 | Create (Pnts : Array1OfPnt; Density : Array1OfReal) returns PGProps |
99 | --- Purpose : |
100 | -- computes the global properties of the system of points Pnts. |
101 | -- A density is associated with each point. |
102 | raises DomainError, |
103 | --- Purpose : |
104 | -- raises if a density is lower or equal to Resolution from package |
105 | -- gp. |
106 | DimensionError; |
107 | --- Purpose : |
108 | -- raises if the length of Pnts and the length of Density |
109 | -- is not the same. |
110 | |
111 | |
112 | |
113 | Create (Pnts : Array2OfPnt; Density : Array2OfReal) returns PGProps |
114 | --- Purpose : |
115 | -- computes the global properties of the system of points Pnts. |
116 | -- A density is associated with each point. |
117 | raises DomainError, |
118 | --- Purpose : |
119 | -- Raised if a density is lower or equal to Resolution from package |
120 | -- gp. |
121 | DimensionError; |
122 | --- Purpose : |
123 | -- Raised if the length of Pnts and the length of Density |
124 | -- is not the same. |
125 | |
126 | |
127 | |
128 | |
129 | Barycentre (myclass; Pnts : Array1OfPnt from TColgp) returns Pnt; |
130 | --- Purpose : |
131 | -- Computes the barycentre of a set of points. The density of the |
132 | -- points is defaulted to 1. |
133 | |
134 | |
135 | Barycentre (myclass; Pnts : Array2OfPnt from TColgp) returns Pnt; |
136 | --- Purpose : |
137 | -- Computes the barycentre of a set of points. The density of the |
138 | -- points is defaulted to 1. |
139 | |
140 | |
141 | Barycentre (myclass; Pnts : Array1OfPnt from TColgp; |
142 | Density : Array1OfReal from TColStd; |
143 | Mass : out Real; G : out Pnt) |
144 | --- Purpose : |
145 | -- Computes the barycentre of a set of points. A density is associated |
146 | -- with each point. |
147 | raises DomainError, |
148 | --- Purpose : |
149 | -- raises if a density is lower or equal to Resolution from package |
150 | -- gp. |
151 | DimensionError; |
152 | --- Purpose : |
153 | -- Raised if the length of Pnts and the length of Density |
154 | -- is not the same. |
155 | |
156 | |
157 | Barycentre (myclass; Pnts : Array2OfPnt from TColgp; |
158 | Density : Array2OfReal from TColStd; |
159 | Mass : out Real; G : out Pnt) |
160 | --- Purpose : |
161 | -- Computes the barycentre of a set of points. A density is associated |
162 | -- with each point. |
163 | raises DomainError, |
164 | --- Purpose : |
165 | -- Raised if a density is lower or equal to Resolution from package |
166 | -- gp. |
167 | DimensionError; |
168 | --- Purpose : |
169 | -- Raised if the length of Pnts and the length of Density |
170 | -- is not the same. |
171 | |
172 | |
173 | end PGProps; |
174 | |
175 | |
176 | |