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

7fd59977 | 1 | -- File: BRepGProp.cdl |

2 | -- Created: Fri Dec 4 16:56:29 1992 | |

3 | -- Author: Isabelle GRIGNON | |

4 | -- <isg@sdsun2> | |

5 | ---Copyright: Matra Datavision 1992 | |

6 | ||

7 | ||

8 | ||

9 | package BRepGProp | |

10 | ||

11 | ---Purpose: Provides global functions to compute a shape's global | |

12 | -- properties for lines, surfaces or volumes, and bring | |

13 | -- them together with the global properties already | |

14 | -- computed for a geometric system. | |

15 | -- The global properties computed for a system are : | |

16 | -- - its mass, | |

17 | -- - its center of mass, | |

18 | -- - its matrix of inertia, | |

19 | -- - its moment about an axis, | |

20 | -- - its radius of gyration about an axis, | |

21 | -- - and its principal properties of inertia such as | |

22 | -- principal axis, principal moments, principal radius of gyration. | |

23 | ||

24 | uses GProp, | |

25 | BRepAdaptor, | |

26 | BRepTools, | |

27 | BRep, | |

28 | TopExp, | |

29 | TopoDS, | |

30 | Geom2dAdaptor, | |

31 | gp, | |

32 | GeomAbs, | |

33 | TColStd | |

34 | ||

35 | is | |

36 | ||

37 | class EdgeTool; | |

38 | ||

39 | class Face; | |

40 | ||

41 | class Domain; | |

42 | ||

43 | class Cinert instantiates CGProps from GProp( Curve from BRepAdaptor, | |

44 | EdgeTool from BRepGProp); | |

45 | ||

46 | class Sinert instantiates SGProps from GProp( Edge from TopoDS, | |

47 | Face from BRepGProp , | |

48 | Domain from BRepGProp); | |

49 | ||

50 | class Vinert instantiates VGProps from GProp( Edge from TopoDS, | |

51 | Face from BRepGProp, | |

52 | Domain from BRepGProp); | |

53 | ||

54 | class VinertGK instantiates VGPropsGK from GProp( Edge from TopoDS, | |

55 | Face from BRepGProp, | |

56 | Domain from BRepGProp); | |

57 | -- | |

58 | -- Package methods to compute global properties. | |

59 | -- | |

60 | ||

61 | LinearProperties(S : Shape from TopoDS; LProps : in out GProps from GProp); | |

62 | ---Purpose: Computes the linear global properties of the shape S, | |

63 | -- i.e. the global properties induced by each edge of the | |

64 | -- shape S, and brings them together with the global | |

65 | -- properties still retained by the framework LProps. If | |

66 | -- the current system of LProps was empty, its global | |

67 | -- properties become equal to the linear global | |

68 | -- properties of S. | |

69 | -- For this computation no linear density is attached to | |

70 | -- the edges. So, for example, the added mass | |

71 | -- corresponds to the sum of the lengths of the edges of | |

72 | -- S. The density of the composed systems, i.e. that of | |

73 | -- each component of the current system of LProps, and | |

74 | -- that of S which is considered to be equal to 1, must be coherent. | |

75 | -- Note that this coherence cannot be checked. You are | |

76 | -- advised to use a separate framework for each | |

77 | -- density, and then to bring these frameworks together | |

78 | -- into a global one. | |

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

80 | -- computed is the reference point of the framework LProps. | |

81 | -- Note: if your programming ensures that the framework | |

82 | -- LProps retains only linear global properties (brought | |

83 | -- together for example, by the function | |

84 | -- LinearProperties) for objects the density of which is | |

85 | -- equal to 1 (or is not defined), the function Mass will | |

86 | -- return the total length of edges of the system analysed by LProps. | |

87 | -- Warning | |

88 | -- No check is performed to verify that the shape S | |

89 | -- retains truly linear properties. If S is simply a vertex, it | |

90 | -- is not considered to present any additional global properties. | |

91 | ||

92 | SurfaceProperties(S : Shape from TopoDS; SProps : in out GProps from GProp); | |

93 | ---Purpose: Computes the surface global properties of the | |

94 | -- shape S, i.e. the global properties induced by each | |

95 | -- face of the shape S, and brings them together with | |

96 | -- the global properties still retained by the framework | |

97 | -- SProps. If the current system of SProps was empty, | |

98 | -- its global properties become equal to the surface | |

99 | -- global properties of S. | |

100 | -- For this computation, no surface density is attached | |

101 | -- to the faces. Consequently, the added mass | |

102 | -- corresponds to the sum of the areas of the faces of | |

103 | -- S. The density of the component systems, i.e. that | |

104 | -- of each component of the current system of | |

105 | -- SProps, and that of S which is considered to be | |

106 | -- equal to 1, must be coherent. | |

107 | -- Note that this coherence cannot be checked. You | |

108 | -- are advised to use a framework for each different | |

109 | -- value of density, and then to bring these | |

110 | -- frameworks together into a global one. | |

111 | -- The point relative to which the inertia of the system | |

112 | -- is computed is the reference point of the framework SProps. | |

113 | -- Note : if your programming ensures that the | |

114 | -- framework SProps retains only surface global | |

115 | -- properties, brought together, for example, by the | |

116 | -- function SurfaceProperties, for objects the density | |

117 | -- of which is equal to 1 (or is not defined), the | |

118 | -- function Mass will return the total area of faces of | |

119 | -- the system analysed by SProps. | |

120 | -- Warning | |

121 | -- No check is performed to verify that the shape S | |

122 | -- retains truly surface properties. If S is simply a | |

123 | -- vertex, an edge or a wire, it is not considered to | |

124 | -- present any additional global properties. | |

125 | ||

126 | SurfaceProperties(S : Shape from TopoDS; SProps : in out GProps from GProp; | |

127 | Eps: Real) returns Real; | |

128 | ---Purpose: Updates <SProps> with the shape <S>, that contains its pricipal properties. | |

129 | -- The surface properties of all the faces in <S> are computed. | |

130 | -- Adaptive 2D Gauss integration is used. | |

131 | -- Parameter Eps sets maximal relative error of computed mass (area) for each face. | |

132 | -- Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values | |

133 | -- for two successive steps of adaptive integration. | |

134 | -- Method returns estimation of relative error reached for whole shape. | |

135 | -- WARNING: if Eps > 0.001 algorithm performs non-adaptive integration. | |

136 | ||

137 | ||

138 | ------------------------ | |

139 | -- VolumeProperties -- | |

140 | ------------------------ | |

141 | ||

142 | ---Purpose: | |

143 | -- Computes the global volume properties of the solid | |

144 | -- S, and brings them together with the global | |

145 | -- properties still retained by the framework VProps. If | |

146 | -- the current system of VProps was empty, its global | |

147 | -- properties become equal to the global properties of S for volume. | |

148 | -- For this computation, no volume density is attached | |

149 | -- to the solid. Consequently, the added mass | |

150 | -- corresponds to the volume of S. The density of the | |

151 | -- component systems, i.e. that of each component of | |

152 | -- the current system of VProps, and that of S which | |

153 | -- is considered to be equal to 1, must be coherent to each other. | |

154 | -- Note that this coherence cannot be checked. You | |

155 | -- are advised to use a separate framework for each | |

156 | -- density, and then to bring these frameworks | |

157 | -- together into a global one. | |

158 | -- The point relative to which the inertia of the system | |

159 | -- is computed is the reference point of the framework VProps. | |

160 | -- Note: if your programming ensures that the | |

161 | -- framework VProps retains only global properties of | |

162 | -- volume (brought together for example, by the | |

163 | -- function VolumeProperties) for objects the density | |

164 | -- of which is equal to 1 (or is not defined), the | |

165 | -- function Mass will return the total volume of the | |

166 | -- solids of the system analysed by VProps. | |

167 | -- Warning | |

168 | -- The shape S must represent an object whose | |

169 | -- global volume properties can be computed. It may | |

170 | -- be a finite solid, or a series of finite solids all | |

171 | -- oriented in a coherent way. Nonetheless, S must be | |

172 | -- exempt of any free boundary. Note that these | |

173 | -- conditions of coherence are not checked by this | |

174 | -- algorithm, and results will be false if they are not respected. | |

175 | VolumeProperties(S : Shape from TopoDS; VProps : in out GProps from GProp; | |

176 | OnlyClosed: Boolean = Standard_False); | |

177 | ||

178 | VolumeProperties(S : Shape from TopoDS; VProps : in out GProps from GProp; | |

179 | Eps: Real; OnlyClosed: Boolean = Standard_False) returns Real; | |

180 | ---Purpose: Updates <VProps> with the shape <S>, that contains its pricipal properties. | |

181 | -- The volume properties of all the FORWARD and REVERSED faces in <S> are computed. | |

182 | -- If OnlyClosed is True then computed faces must belong to closed Shells. | |

183 | -- Adaptive 2D Gauss integration is used. | |

184 | -- Parameter Eps sets maximal relative error of computed mass (volume) for each face. | |

185 | -- Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values | |

186 | -- for two successive steps of adaptive integration. | |

187 | -- Method returns estimation of relative error reached for whole shape. | |

188 | -- WARNING: if Eps > 0.001 algorithm performs non-adaptive integration. | |

189 | ||

190 | ||

191 | ||

192 | ||

193 | ||

194 | ||

195 | -- ---------------------------------------------------------------------------------------- | |

196 | VolumePropertiesGK(S : Shape from TopoDS; | |

197 | VProps : in out GProps from GProp; | |

198 | Eps : Real from Standard = 0.001; | |

199 | OnlyClosed: Boolean from Standard = Standard_False; | |

200 | IsUseSpan : Boolean from Standard = Standard_False; | |

201 | CGFlag : Boolean from Standard = Standard_False; | |

202 | IFlag : Boolean from Standard = Standard_False) | |

203 | ||

204 | returns Real; | |

205 | ---Purpose: Updates <VProps> with the shape <S>, that contains its pricipal properties. | |

206 | -- The volume properties of all the FORWARD and REVERSED faces in <S> are computed. | |

207 | -- If OnlyClosed is True then computed faces must belong to closed Shells. | |

208 | -- Adaptive 2D Gauss integration is used. | |

209 | -- Parameter IsUseSpan says if it is necessary to define spans on a face. | |

210 | -- This option has an effect only for BSpline faces. | |

211 | -- Parameter Eps sets maximal relative error of computed property for each face. | |

212 | -- Error is delivered by the adaptive Gauss-Kronrod method of integral computation | |

213 | -- that is used for properties computation. | |

214 | -- Method returns estimation of relative error reached for whole shape. | |

215 | -- Returns negative value if the computation is failed. | |

216 | VolumePropertiesGK(S : Shape from TopoDS; | |

217 | VProps : in out GProps from GProp; | |

218 | thePln: Pln from gp; | |

219 | Eps : Real from Standard = 0.001; | |

220 | OnlyClosed: Boolean from Standard = Standard_False; | |

221 | IsUseSpan : Boolean from Standard = Standard_False; | |

222 | CGFlag : Boolean from Standard = Standard_False; | |

223 | IFlag : Boolean from Standard = Standard_False) | |

224 | returns Real; | |

225 | ||

226 | end BRepGProp; | |

227 | ||

228 | ||

229 | ||

230 | ||

231 |