Commit | Line | Data |
---|---|---|

b311480e | 1 | -- Created on: 1992-02-14 |

2 | -- Created by: Jean Claude VAUTHIER | |

3 | -- Copyright (c) 1992-1999 Matra Datavision | |

973c2be1 | 4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |

b311480e | 5 | -- |

973c2be1 | 6 | -- This file is part of Open CASCADE Technology software library. |

b311480e | 7 | -- |

d5f74e42 | 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 | |

973c2be1 | 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. | |

b311480e | 13 | -- |

973c2be1 | 14 | -- Alternatively, this file may be used under the terms of Open CASCADE |

15 | -- commercial license or contractual agreement. | |

7fd59977 | 16 | |

17 | class PGProps | |

18 | ||

19 | from GProp | |

20 | ||

21 | inherits GProps | |

22 | ---Purpose: A framework for computing the global properties of a | |

23 | -- set of points. | |

24 | -- A point mass is attached to each point. The global | |

25 | -- mass of the system is the sum of each individual | |

26 | -- mass. By default, the point mass is equal to 1 and the | |

27 | -- mass of a system composed of N points is equal to N. | |

28 | -- Warning | |

29 | -- A framework of this sort provides functions to handle | |

30 | -- sets of points easily. But, like any GProp_GProps | |

31 | -- object, by using the Add function, it can theoretically | |

32 | -- bring together the computed global properties and | |

33 | -- those of a system more complex than a set of points . | |

34 | -- The mass of each point and the density of each | |

35 | -- component of the composed system must be | |

36 | -- coherent. Note that this coherence cannot be checked. | |

37 | -- Nonetheless, you are advised to restrict your use of a | |

38 | -- GProp_PGProps object to a set of points and to | |

39 | -- create a GProp_GProps object in order to bring | |

40 | -- together global properties of different systems. | |

41 | ||

42 | uses Pnt from gp, | |

43 | Array1OfPnt from TColgp, | |

44 | Array2OfPnt from TColgp, | |

45 | Array1OfReal from TColStd, | |

46 | Array2OfReal from TColStd | |

47 | ||

48 | ||

49 | raises DimensionError from Standard, | |

50 | DomainError from Standard | |

51 | ||

52 | is | |

53 | ||

54 | Create returns PGProps; | |

55 | --- Purpose : Initializes a framework to compute global properties | |

56 | -- on a set of points. | |

57 | -- The point relative to which the inertia of the system is | |

58 | -- computed will be the origin (0, 0, 0) of the | |

59 | -- absolute Cartesian coordinate system. | |

60 | -- At initialization, the framework is empty, i.e. it retains | |

61 | -- no dimensional information such as mass and inertia. | |

62 | -- It is, however, now able to keep global properties of a | |

63 | -- set of points while new points are added using the | |

64 | -- AddPoint function. | |

65 | -- The set of points whose global properties are brought | |

66 | -- together by this framework will then be referred to as | |

67 | -- the current system. The current system is, however, | |

68 | -- not kept by this framework, which only keeps that | |

69 | -- system's global properties. Note that the current | |

70 | -- system may be more complex than a set of points. | |

71 | ||

72 | ||

73 | AddPoint (me : in out; P : Pnt) | |

74 | --- Purpose : Brings together the global properties already | |

75 | -- retained by this framework with those induced by | |

76 | -- the point Pnt. Pnt may be the first point of the current system. | |

77 | -- A point mass is attached to the point Pnt, it is either | |

78 | -- equal to 1. or to Density. | |

79 | is static; | |

80 | ||

81 | ||

82 | AddPoint (me : in out; P : Pnt; Density : Real) | |

83 | --- Purpose : | |

84 | -- Adds a new point P with its density in the system of points | |

85 | -- Exceptions | |

86 | -- Standard_DomainError if the mass value Density | |

87 | -- is less than gp::Resolution(). | |

88 | raises DomainError | |

89 | is static; | |

90 | ||

91 | ||

92 | Create (Pnts : Array1OfPnt) 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 : Array2OfPnt) returns PGProps; | |

99 | --- Purpose : | |

100 | -- computes the global properties of the system of points Pnts. | |

101 | -- The density of the points are defaulted to all being 1 | |

102 | ||

103 | ||

104 | Create (Pnts : Array1OfPnt; Density : Array1OfReal) returns PGProps | |

105 | --- Purpose : | |

106 | -- computes the global properties of the system of points Pnts. | |

107 | -- A density is associated with each point. | |

108 | raises DomainError, | |

109 | --- Purpose : | |

110 | -- raises if a density is lower or equal to Resolution from package | |

111 | -- gp. | |

112 | DimensionError; | |

113 | --- Purpose : | |

114 | -- raises if the length of Pnts and the length of Density | |

115 | -- is not the same. | |

116 | ||

117 | ||

118 | ||

119 | Create (Pnts : Array2OfPnt; Density : Array2OfReal) returns PGProps | |

120 | --- Purpose : | |

121 | -- computes the global properties of the system of points Pnts. | |

122 | -- A density is associated with each point. | |

123 | raises DomainError, | |

124 | --- Purpose : | |

125 | -- Raised if a density is lower or equal to Resolution from package | |

126 | -- gp. | |

127 | DimensionError; | |

128 | --- Purpose : | |

129 | -- Raised if the length of Pnts and the length of Density | |

130 | -- is not the same. | |

131 | ||

132 | ||

133 | ||

134 | ||

135 | Barycentre (myclass; Pnts : Array1OfPnt 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 : Array2OfPnt from TColgp) returns Pnt; | |

142 | --- Purpose : | |

143 | -- Computes the barycentre of a set of points. The density of the | |

144 | -- points is defaulted to 1. | |

145 | ||

146 | ||

147 | Barycentre (myclass; Pnts : Array1OfPnt from TColgp; | |

148 | Density : Array1OfReal from TColStd; | |

149 | Mass : out Real; G : out Pnt) | |

150 | --- Purpose : | |

151 | -- Computes the barycentre of a set of points. A density is associated | |

152 | -- with each point. | |

153 | raises DomainError, | |

154 | --- Purpose : | |

155 | -- raises if a density is lower or equal to Resolution from package | |

156 | -- gp. | |

157 | DimensionError; | |

158 | --- Purpose : | |

159 | -- Raised if the length of Pnts and the length of Density | |

160 | -- is not the same. | |

161 | ||

162 | ||

163 | Barycentre (myclass; Pnts : Array2OfPnt from TColgp; | |

164 | Density : Array2OfReal from TColStd; | |

165 | Mass : out Real; G : out Pnt) | |

166 | --- Purpose : | |

167 | -- Computes the barycentre of a set of points. A density is associated | |

168 | -- with each point. | |

169 | raises DomainError, | |

170 | --- Purpose : | |

171 | -- Raised if a density is lower or equal to Resolution from package | |

172 | -- gp. | |

173 | DimensionError; | |

174 | --- Purpose : | |

175 | -- Raised if the length of Pnts and the length of Density | |

176 | -- is not the same. | |

177 | ||

178 | ||

179 | end PGProps; | |

180 | ||

181 | ||

182 |