1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
-- File: Extrema_GExtPC.cdl
-- Created: Mon Oct 19 11:55:06 1992
-- Author: Laurent PAINNOT
-- <lpa@phylox>
---Copyright: Matra Datavision 1992
generic class GExtPC from Extrema(
TheCurve as any;
TheCurveTool as any;
TheExtPElC as any;
ThePoint as any;
TheVector as any;
ThePOnC as any;
TheSequenceOfPOnC as any)
---Purpose: It calculates all the distances between a point and a
-- curve. The Algorithm finds the C2 intervals on the
-- curve.
uses
SequenceOfBoolean from TColStd,
SequenceOfReal from TColStd,
CurveType from GeomAbs
raises
NotDone from StdFail,
OutOfRange from Standard,
TypeMismatch from Standard
class EPC instantiates GenExtPC from Extrema
(TheCurve,
TheCurveTool,
ThePOnC,
ThePoint,
TheVector);
is
Create returns GExtPC;
Create(P : ThePoint;
C : TheCurve;
Uinf, Usup : Real from Standard;
TolF : Real from Standard = 1.0e-10)
---Purpose: It calculates all the distances.
-- The function F(u)=distance(P,C(u)) has an extremum
-- when g(u)=dF/du=0. The algorithm searchs all the
-- zeros inside the definition range of the curve.
-- Zeros are searched between uinf and usup.
-- Tol is used to decide to stop the
-- iterations according to the following condition:
-- if n is the number of iterations,
-- the algorithm stops when abs(F(Un)-F(Un-1)) < Tol.
returns GExtPC;
Create(P : ThePoint;
C : TheCurve;
TolF : Real from Standard = 1.0e-10)
---Purpose: It calculates all the distances.
-- The function F(u)=distance(P,C(u)) has an extremum
-- when g(u)=dF/du=0. The algorithm searchs all the
-- zeros inside the definition range of the curve.
-- Tol is used to decide to stop the
-- iterations according to the following condition:
-- if n is the number of iterations,
-- the algorithm stops when abs(F(Un)-F(Un-1)) < Tol.
returns GExtPC;
Initialize(me : in out; C : TheCurve;
Uinf, Usup : Real from Standard;
TolF : Real from Standard = 1.0e-10)
---Purpose: initializes the fields of the algorithm.
is static;
Perform(me: in out; P: ThePoint)
---Purpose: An exception is raised if the fields have not been
-- initialized.
raises TypeMismatch from Standard
is static;
IntervalPerform(me: in out; P: ThePoint)
is static protected;
IsDone(me) returns Boolean from Standard
---Purpose: True if the distances are found.
is static;
SquareDistance(me; N: Integer from Standard) returns Real from Standard
---Purpose: Returns the value of the <N>th extremum square distance.
raises NotDone from StdFail,
OutOfRange from Standard
is static;
NbExt(me) returns Integer from Standard
---Purpose: Returns the number of extremum distances.
raises NotDone from StdFail
is static;
IsMin(me; N: Integer from Standard) returns Boolean from Standard
---Purpose: Returns True if the <N>th extremum distance is a
-- minimum.
raises NotDone from StdFail,
OutOfRange from Standard
is static;
Point(me; N: Integer from Standard) returns ThePOnC
---Purpose: Returns the point of the <N>th extremum distance.
raises NotDone from StdFail,
OutOfRange from Standard
is static;
TrimmedSquareDistances(me; dist1: out Real from Standard;
dist2: out Real from Standard;
P1: out ThePoint;
P2: out ThePoint)
---Purpose: if the curve is a trimmed curve,
-- dist1 is a square distance between <P> and the point
-- of parameter FirstParameter <P1> and
-- dist2 is a square distance between <P> and the point
-- of parameter LastParameter <P2>.
is static;
fields
myC: Address from Standard;
Pf: ThePoint;
Pl: ThePoint;
myExtPElC: TheExtPElC;
mypoint: TheSequenceOfPOnC;
mydone: Boolean from Standard;
mydist1: Real from Standard;
mydist2: Real from Standard;
myExtPC: EPC from Extrema;
mytolu: Real from Standard;
mytolf: Real from Standard;
mysample: Integer from Standard;
myintuinf: Real from Standard;
myintusup: Real from Standard;
myuinf: Real from Standard;
myusup: Real from Standard;
type: CurveType from GeomAbs;
myismin: SequenceOfBoolean from TColStd;
mySqDist: SequenceOfReal from TColStd;
end GExtPC;
|