7fd59977 |
1 | -- File: Extrema_ExtPElC2d.cdl |
2 | -- Created: Mon Dec 13 12:10:35 1993 |
3 | -- Author: Christophe MARION |
4 | -- <cma@zerox> |
5 | ---Copyright: Matra Datavision 1993 |
6 | |
7 | class ExtPElC2d from Extrema |
8 | ---Purpose: It calculates all the distances between a point |
9 | -- and an elementary curve. |
10 | -- These distances can be minimum or maximum. |
11 | |
12 | uses POnCurv2d from Extrema, |
13 | Lin2d from gp, |
14 | Circ2d from gp, |
15 | Elips2d from gp, |
16 | Hypr2d from gp, |
17 | Parab2d from gp, |
18 | Pnt2d from gp |
19 | |
20 | raises NotDone from StdFail, |
21 | OutOfRange from Standard |
22 | |
23 | is |
24 | Create returns ExtPElC2d; |
25 | |
26 | Create (P: Pnt2d; C: Lin2d; Tol: Real; |
27 | Uinf: Real; Usup: Real) |
28 | returns ExtPElC2d; |
29 | ---Purpose: Calculates the extremum distance between the |
30 | -- point P and the segment [Uinf,Usup] of the line L. |
31 | |
32 | |
33 | Perform(me: in out; P: Pnt2d; L: Lin2d; Tol: Real; Uinf,Usup: Real) |
34 | is static; |
35 | |
36 | Create (P: Pnt2d; C: Circ2d; Tol: Real; |
37 | Uinf: Real; Usup: Real) |
38 | returns ExtPElC2d; |
39 | ---Purpose: Calculates the 2 extremum distances between the |
40 | -- point P and the segment [Uinf,Usup] of the circle C. |
41 | -- Tol is used to determine |
42 | -- if P is on the axis of the circle or |
43 | -- if an extremum is on an endpoint of the segment. |
44 | -- If P is on the axis of the circle, |
45 | -- there are infinite solution then IsDone(me)=False. |
46 | -- The conditions on the Uinf and Usup are: |
47 | -- 0. <= Uinf <= 2.*PI and Usup > Uinf. |
48 | -- If Usup > Uinf + 2.*PI, then only the solutions in |
49 | -- the range [Uinf,Uinf+2.*PI[ are computed. |
50 | |
51 | |
52 | Perform(me: in out; P: Pnt2d; C: Circ2d; Tol: Real; Uinf,Usup: Real) |
53 | is static; |
54 | |
55 | Create (P: Pnt2d; C: Elips2d; Tol: Real; |
56 | Uinf: Real; Usup: Real) |
57 | returns ExtPElC2d; |
58 | ---Purpose: Calculates the 4 extremum distances between the |
59 | -- point P and the segment [Uinf,Usup] of the elipse C. |
60 | -- Tol is used to determine |
61 | -- if the point is on the axis of the elipse and |
62 | -- if the major radius is equal to the minor radius or |
63 | -- if an extremum is on an endpoint of the segment. |
64 | -- If P is on the axis of the elipse, |
65 | -- there are infinite solution then IsDone(me)=False. |
66 | -- The conditions on the Uinf and Usup are: |
67 | -- 0. <= Uinf <= 2.*PI and Usup > Uinf. |
68 | -- If Usup > Uinf + 2.*PI, then only the solutions in |
69 | -- the range [Uinf,Uinf+2.*PI[ are computed. |
70 | |
71 | |
72 | Perform(me: in out; P: Pnt2d; C: Elips2d; Tol: Real; Uinf,Usup: Real) |
73 | is static; |
74 | |
75 | Create (P: Pnt2d; C: Hypr2d; Tol: Real; Uinf: Real; |
76 | Usup: Real) |
77 | returns ExtPElC2d; |
78 | ---Purpose: Calculates the extremum distances between the |
79 | -- point P and the segment [Uinf,Usup] of the hyperbola |
80 | -- C. |
81 | -- Tol is used to determine if two solutions u and v |
82 | -- are identical; the condition is: |
83 | -- dist(C(u),C(v)) < Tol. |
84 | |
85 | Perform(me: in out; P: Pnt2d; C: Hypr2d; Tol: Real; Uinf,Usup: Real) |
86 | is static; |
87 | |
88 | Create (P: Pnt2d; C: Parab2d; Tol: Real; Uinf: Real; |
89 | Usup: Real) |
90 | returns ExtPElC2d; |
91 | ---Purpose: Calculates the 4 extremum distances between the |
92 | -- point P and the segment [Uinf,Usup] of the parabola |
93 | -- C. |
94 | -- Tol is used to determine if two solutions u and v |
95 | -- are identical; the condition is: |
96 | -- dist(C(u),C(v)) < Tol. |
97 | |
98 | Perform(me: in out; P: Pnt2d; C: Parab2d; Tol: Real; Uinf,Usup: Real) |
99 | is static; |
100 | |
101 | |
102 | IsDone (me) returns Boolean |
103 | ---Purpose: True if the distances are found. |
104 | is static; |
105 | |
106 | NbExt (me) returns Integer |
107 | ---Purpose: Returns the number of extremum distances. |
108 | raises NotDone from StdFail |
109 | -- if IsDone(me)=False. |
110 | is static; |
111 | |
112 | SquareDistance (me; N: Integer) returns Real |
113 | ---Purpose: Returns the value of the Nth extremum square distance. |
114 | raises NotDone from StdFail, |
115 | -- if IsDone(me)=False. |
116 | OutOfRange |
117 | -- if N < 1 or N > NbPoints(me). |
118 | is static; |
119 | |
120 | IsMin (me; N: Integer) returns Boolean |
121 | ---Purpose: Returns True if the Nth extremum distance is a |
122 | -- minimum. |
123 | raises NotDone from StdFail, |
124 | -- if IsDone(me)=False. |
125 | OutOfRange |
126 | -- if N < 1 or N > NbPoints(me). |
127 | is static; |
128 | |
129 | Point (me; N: Integer) returns POnCurv2d |
130 | ---Purpose: Returns the point of the Nth extremum distance. |
131 | raises NotDone from StdFail, |
132 | -- if IsDone(me)=False. |
133 | OutOfRange |
134 | -- if N < 1 or N > NbPoints(me). |
135 | is static; |
136 | |
137 | fields |
138 | myDone : Boolean; |
139 | myNbExt: Integer; |
140 | mySqDist: Real [4]; |
141 | myIsMin: Boolean [4]; |
142 | myPoint: POnCurv2d from Extrema [4]; |
143 | |
144 | end ExtPElC2d; |