summary | shortlog | log | commit | commitdiff | tree

blob | blame (non-incremental) | history | HEAD

blob | blame (non-incremental) | history | HEAD

... / ...

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

1 | -- File: GeomLib.cdl | |

2 | -- Created: Wed Jul 7 12:38:18 1993 | |

3 | -- Author: Jean Claude VAUTHIER | |

4 | ---Copyright: Matra Datavision 1993 | |

5 | -- jct : modified 15-Apr-97 : added method ExtendSurfByLength | |

6 | ||

7 | ||

8 | package GeomLib | |

9 | ||

10 | ---Purpose: Geom Library. This package provides an | |

11 | -- implementation of functions for basic computation | |

12 | -- on geometric entity from packages Geom and Geom2d. | |

13 | ||

14 | ||

15 | uses | |

16 | TCollection, | |

17 | TColStd, | |

18 | TColgp, | |

19 | TColGeom, | |

20 | TColGeom2d, | |

21 | Adaptor3d, | |

22 | AdvApprox, | |

23 | Geom, | |

24 | Geom2d, | |

25 | GeomAbs, | |

26 | math, | |

27 | gp, | |

28 | StdFail | |

29 | ||

30 | is | |

31 | ||

32 | enumeration InterpolationErrors is | |

33 | ---Purpose: in case the interpolation errors out, this | |

34 | -- tells what happened | |

35 | NoError, | |

36 | NotEnoughtPoints, | |

37 | DegreeSmallerThan3, | |

38 | InversionProblem | |

39 | ||

40 | end InterpolationErrors; | |

41 | ||

42 | -- -- --------------- -- | |

43 | -- C L A S S E S -- | |

44 | -- --------------- -- | |

45 | ||

46 | class Array1OfMat instantiates | |

47 | Array1 from TCollection (Mat from gp); | |

48 | ||

49 | class MakeCurvefromApprox; | |

50 | ---Purpose: This class is used to create the curves ( 2d or | |

51 | -- 3d) rational or not created by the class | |

52 | -- ApproxAFunction from AdvApprox. | |

53 | ||

54 | ||

55 | ||

56 | class Interpolate ; | |

57 | ---Purpose: this class compute the poles of a curve given some | |

58 | -- parameters, points to interpolate and boundary conditions | |

59 | -- in 3d | |

60 | class DenominatorMultiplier ; | |

61 | ---Purpose: this defines an evaluator for a function of 2 variables | |

62 | -- that will be used by CancelDenominatorDerivative in one | |

63 | -- direction. | |

64 | ||

65 | ||

66 | class CheckBSplineCurve ; | |

67 | ---Purpose: Checks for the end tangents : wether or not those | |

68 | -- are reversed regarding the third or n-3rd control | |

69 | -- | |

70 | -- | |

71 | class Check2dBSplineCurve ; | |

72 | ||

73 | ---Purpose: Checks for the end tangents : wether or not those | |

74 | -- are reversed | |

75 | ||

76 | class IsPlanarSurface; | |

77 | ||

78 | class Tool; | |

79 | ---Purpose: provides various methods with Geom2d and Geom curves | |

80 | --- and surfaces. | |

81 | ||

82 | private class PolyFunc; | |

83 | ||

84 | private class LogSample; | |

85 | ||

86 | pointer DenominatorMultiplierPtr to DenominatorMultiplier from GeomLib ; | |

87 | ------------------------- | |

88 | -- M E T H O D E S -- | |

89 | -- ----------------- -- | |

90 | ||

91 | To3d (Position : in Ax2 from gp; | |

92 | Curve2d : in Curve from Geom2d) | |

93 | returns Curve from Geom; | |

94 | ---Purpose: Computes the curve 3d from package Geom | |

95 | -- corresponding to curve 2d from package Geom2d, on | |

96 | -- the plan defined with the local coordinate system | |

97 | -- Position. | |

98 | ||

99 | ||

100 | GTransform( Curve : in Curve from Geom2d; | |

101 | GTrsf : in GTrsf2d from gp) | |

102 | returns Curve from Geom2d; | |

103 | ---Purpose: Computes the curve 3d from package Geom | |

104 | -- corresponding to the curve 3d from package Geom, | |

105 | -- transformed with the transformation <GTrsf> | |

106 | -- WARNING : this method may return a null Handle if | |

107 | -- it's impossible to compute the transformation of | |

108 | -- a curve. It's not implemented when : | |

109 | -- 1) the curve is an infinite parabola or hyperbola | |

110 | -- 2) the curve is an offsetcurve | |

111 | ||

112 | SameRange(Tolerance : in Real from Standard ; | |

113 | Curve2dPtr : in Curve from Geom2d ; | |

114 | First : in Real from Standard ; | |

115 | Last : in Real from Standard ; | |

116 | RequestedFirst : in Real from Standard ; | |

117 | RequestedLast : in Real from Standard ; | |

118 | NewCurve2dPtr : out Curve from Geom2d) ; | |

119 | ||

120 | ---Purpose: Make the curve Curve2dPtr have the imposed | |

121 | -- range First to List the most economic way, | |

122 | -- that is if it can change the range without | |

123 | -- changing the nature of the curve it will try | |

124 | -- to do that. Otherwise it will produce a Bspline | |

125 | -- curve that has the required range | |

126 | BuildCurve3d(Tolerance : in Real from Standard ; | |

127 | CurvePtr : in out CurveOnSurface from Adaptor3d ; | |

128 | FirstParameter : in Real from Standard ; | |

129 | LastParameter : in Real from Standard ; | |

130 | NewCurvePtr : out Curve from Geom ; | |

131 | MaxDeviation : out Real from Standard ; | |

132 | AverageDeviation : out Real from Standard ; | |

133 | Continuity : Shape from GeomAbs = GeomAbs_C1; | |

134 | MaxDegree : Integer = 14; | |

135 | MaxSegment : Integer = 30); | |

136 | ||

137 | AdjustExtremity(Curve : in out BoundedCurve from Geom; | |

138 | P1, P2 : Pnt from gp; | |

139 | T1, T2 : Vec from gp); | |

140 | ||

141 | ExtendCurveToPoint(Curve : in out BoundedCurve from Geom; | |

142 | Point : Pnt from gp; | |

143 | Cont : Integer from Standard; | |

144 | After : Boolean from Standard); | |

145 | ---Purpose: Extends the bounded curve Curve to the point Point. | |

146 | -- The extension is built: | |

147 | -- - at the end of the curve if After equals true, or | |

148 | -- - at the beginning of the curve if After equals false. | |

149 | -- The extension is performed according to a degree of | |

150 | -- continuity equal to Cont, which in its turn must be equal to 1, 2 or 3. | |

151 | -- This function converts the bounded curve Curve into a BSpline curve. | |

152 | -- Warning | |

153 | -- - Nothing is done, and Curve is not modified if Cont is | |

154 | -- not equal to 1, 2 or 3. | |

155 | -- - It is recommended that the extension should not be | |

156 | -- too large with respect to the size of the bounded | |

157 | -- curve Curve: Point must not be located too far from | |

158 | -- one of the extremities of Curve. | |

159 | ||

160 | ||

161 | ExtendSurfByLength(Surf : in out BoundedSurface from Geom; | |

162 | Length : Real from Standard; | |

163 | Cont : Integer from Standard; | |

164 | InU : Boolean from Standard; | |

165 | After : Boolean from Standard); | |

166 | ---Purpose: | |

167 | -- Extends the bounded surface Surf along one of its | |

168 | -- boundaries. The chord length of the extension is equal to Length. | |

169 | -- The direction of the extension is given as: | |

170 | -- - the u parametric direction of Surf, if InU equals true, or | |

171 | -- - the v parametric direction of Surf, if InU equals false. | |

172 | -- In this parametric direction, the extension is built on the side of: | |

173 | -- - the last parameter of Surf, if After equals true, or | |

174 | -- - the first parameter of Surf, if After equals false. | |

175 | -- The extension is performed according to a degree of | |

176 | -- continuity equal to Cont, which in its turn must be equal to 1, 2 or 3. | |

177 | -- This function converts the bounded surface Surf into a BSpline surface. | |

178 | -- Warning | |

179 | -- - Nothing is done, and Surf is not modified if Cont is | |

180 | -- not equal to 1, 2 or 3. | |

181 | -- - It is recommended that Length, the size of the | |

182 | -- extension should not be too large with respect to the | |

183 | -- size of the bounded surface Surf. | |

184 | -- - Surf must not be a periodic BSpline surface in the | |

185 | -- parametric direction corresponding to the direction of extension. | |

186 | ||

187 | ||

188 | ||

189 | AxeOfInertia(Points : Array1OfPnt from TColgp; | |

190 | Axe : out Ax2 from gp; | |

191 | IsSingular : out Boolean; | |

192 | Tol : Real = 1.0e-7); | |

193 | ---Purpose: Compute axes of inertia, of some points -- -- -- | |

194 | -- <Axe>.Location() is the BaryCentre -- -- -- -- -- | |

195 | -- <Axe>.XDirection is the axe of upper inertia -- -- -- | |

196 | -- -- <Axe>.Direction is the Normal to the average plane | |

197 | -- -- -- -- IsSingular is True if points are on line -- | |

198 | -- Tol is used to determine singular cases. | |

199 | ||

200 | Inertia(Points : Array1OfPnt from TColgp; | |

201 | Bary : out Pnt from gp; | |

202 | XDir,YDir : out Dir from gp; | |

203 | Xgap,YGap,ZGap : out Real); | |

204 | ---Level: Advanced | |

205 | ---Purpose: Compute principale axes of inertia, and dispertion | |

206 | -- value of some points. | |

207 | ||

208 | ||

209 | RemovePointsFromArray(NumPoints : Integer from Standard ; | |

210 | InParameters : Array1OfReal from TColStd ; | |

211 | OutParameters : in out HArray1OfReal from TColStd) ; | |

212 | ---Purpose: Warning! This assume that the InParameter is an increasing sequence | |

213 | -- of real number and it will not check for that : Unpredictable | |

214 | -- result can happen if this is not satisfied. It is the caller | |

215 | -- responsability to check for that property. | |

216 | -- | |

217 | -- This method makes uniform NumPoints segments S1,...SNumPoints out | |

218 | -- of the segment defined by the first parameter and the | |

219 | -- last parameter ofthe InParameter ; keeps only one | |

220 | -- point of the InParameters set of parameter in each of | |

221 | -- the uniform segments taking care of the first and the | |

222 | -- last parameters. For the ith segment the element of | |

223 | -- the InParameter is the one that is the first to exceed | |

224 | -- the midpoint of the segment and to fall before the | |

225 | -- midpoint of the next segment | |

226 | -- There will be at the end at most NumPoints + 1 if | |

227 | -- NumPoints > 2 in the OutParameters Array | |

228 | ||

229 | ||

230 | DensifyArray1OfReal(MinNumPoints : Integer from Standard ; | |

231 | InParameters : Array1OfReal from TColStd ; | |

232 | OutParameters : in out HArray1OfReal from TColStd) ; | |

233 | ---Purpose: this makes sure that there is at least MinNumPoints | |

234 | -- in OutParameters taking into account the parameters in | |

235 | -- the InParameters array provided those are in order, | |

236 | -- that is the sequence of real in the InParameter is strictly | |

237 | -- non decreasing | |

238 | -- | |

239 | ||

240 | FuseIntervals(Interval1, Interval2 : Array1OfReal from TColStd; | |

241 | Fusion : out SequenceOfReal from TColStd; | |

242 | Confusion : Real = 1.0e-9); | |

243 | ||

244 | EvalMaxParametricDistance(Curve : Curve from Adaptor3d ; | |

245 | AReferenceCurve : Curve from Adaptor3d ; | |

246 | Tolerance : Real from Standard ; | |

247 | Parameters : Array1OfReal from TColStd ; | |

248 | MaxDistance : out Real from Standard) ; | |

249 | ||

250 | ---Purpose: this will compute the maximum distance at the | |

251 | -- parameters given in the Parameters array by | |

252 | -- evaluating each parameter the two curves and taking | |

253 | -- the maximum of the evaluated distance | |

254 | ||

255 | EvalMaxDistanceAlongParameter(Curve : Curve from Adaptor3d ; | |

256 | AReferenceCurve : Curve from Adaptor3d ; | |

257 | Tolerance : Real from Standard ; | |

258 | Parameters : Array1OfReal from TColStd ; | |

259 | MaxDistance : out Real from Standard) ; | |

260 | ---Purpose: this will compute the maximum distancef at the parameters | |

261 | -- given in the Parameters array by projecting from the Curve | |

262 | -- to the reference curve and taking the minimum distance | |

263 | -- Than the maximum will be taken on those minimas. | |

264 | ||

265 | CancelDenominatorDerivative(BSurf : in out BSplineSurface from Geom ; | |

266 | UDirection : in Boolean from Standard ; | |

267 | VDirection : in Boolean from Standard) ; | |

268 | ---Purpose: Cancel,on the boudaries,the denominator first derivative | |

269 | -- in the directions wished by the user and set its value to 1. | |

270 | ||

271 | ||

272 | -- TensorialProduct(S : in out BSplineSurface from Geom; | |

273 | -- Poles : Array1OfMat from GeomLib; | |

274 | -- TPoles : Array1OfPnt from TColgp; | |

275 | -- Knots : Array1OfReal from TColStd; | |

276 | -- Mults : Array1OfInteger from TColStd); | |

277 | -- Purpose: Compute the Tensorial product beetween an | |

278 | -- BSplineSurface <S>(U,V) and an Transformation Law M(v) | |

279 | -- given by NUBS form (<Poles>, <Knots>, <Mults>). The result | |

280 | -- Surface is R(U,V) = M(V)*S(U,V)+T(V). | |

281 | ||

282 | NormEstim(S : Surface from Geom; | |

283 | UV : Pnt2d from gp; | |

284 | Tol : Real from Standard; | |

285 | N : in out Dir from gp) | |

286 | ||

287 | returns Integer from Standard; | |

288 | -- Purpose: Computes normal of surface S in UV point UV | |

289 | -- for regular point N = DU^DV | |

290 | -- if |DU| < Tol or |DV| < Tol special treatment is used: | |

291 | -- N is computed on base of normal of corresponding isoline | |

292 | -- of S | |

293 | -- returns 0 for regular point, | |

294 | -- 1 for quasysingular (ex.: sphere pole) | |

295 | -- 2 for conical singular point | |

296 | -- 3 if computation impossible (for ex. DU||DV - tangent isolines) | |

297 | ||

298 | ||

299 | end GeomLib; | |

300 | ||

301 |