b311480e |
1 | -- Created on: 1993-12-13 |
2 | -- Created by: Christophe MARION |
3 | -- Copyright (c) 1993-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | class ExtPElC2d from Extrema |
23 | ---Purpose: It calculates all the distances between a point |
24 | -- and an elementary curve. |
25 | -- These distances can be minimum or maximum. |
26 | |
27 | uses POnCurv2d from Extrema, |
28 | Lin2d from gp, |
29 | Circ2d from gp, |
30 | Elips2d from gp, |
31 | Hypr2d from gp, |
32 | Parab2d from gp, |
33 | Pnt2d from gp |
34 | |
35 | raises NotDone from StdFail, |
36 | OutOfRange from Standard |
37 | |
38 | is |
39 | Create returns ExtPElC2d; |
40 | |
41 | Create (P: Pnt2d; C: Lin2d; Tol: Real; |
42 | Uinf: Real; Usup: Real) |
43 | returns ExtPElC2d; |
44 | ---Purpose: Calculates the extremum distance between the |
45 | -- point P and the segment [Uinf,Usup] of the line L. |
46 | |
47 | |
48 | Perform(me: in out; P: Pnt2d; L: Lin2d; Tol: Real; Uinf,Usup: Real) |
49 | is static; |
50 | |
51 | Create (P: Pnt2d; C: Circ2d; Tol: Real; |
52 | Uinf: Real; Usup: Real) |
53 | returns ExtPElC2d; |
54 | ---Purpose: Calculates the 2 extremum distances between the |
55 | -- point P and the segment [Uinf,Usup] of the circle C. |
56 | -- Tol is used to determine |
57 | -- if P is on the axis of the circle or |
58 | -- if an extremum is on an endpoint of the segment. |
59 | -- If P is on the axis of the circle, |
60 | -- there are infinite solution then IsDone(me)=False. |
61 | -- The conditions on the Uinf and Usup are: |
62 | -- 0. <= Uinf <= 2.*PI and Usup > Uinf. |
63 | -- If Usup > Uinf + 2.*PI, then only the solutions in |
64 | -- the range [Uinf,Uinf+2.*PI[ are computed. |
65 | |
66 | |
67 | Perform(me: in out; P: Pnt2d; C: Circ2d; Tol: Real; Uinf,Usup: Real) |
68 | is static; |
69 | |
70 | Create (P: Pnt2d; C: Elips2d; Tol: Real; |
71 | Uinf: Real; Usup: Real) |
72 | returns ExtPElC2d; |
73 | ---Purpose: Calculates the 4 extremum distances between the |
74 | -- point P and the segment [Uinf,Usup] of the elipse C. |
75 | -- Tol is used to determine |
76 | -- if the point is on the axis of the elipse and |
77 | -- if the major radius is equal to the minor radius or |
78 | -- if an extremum is on an endpoint of the segment. |
79 | -- If P is on the axis of the elipse, |
80 | -- there are infinite solution then IsDone(me)=False. |
81 | -- The conditions on the Uinf and Usup are: |
82 | -- 0. <= Uinf <= 2.*PI and Usup > Uinf. |
83 | -- If Usup > Uinf + 2.*PI, then only the solutions in |
84 | -- the range [Uinf,Uinf+2.*PI[ are computed. |
85 | |
86 | |
87 | Perform(me: in out; P: Pnt2d; C: Elips2d; Tol: Real; Uinf,Usup: Real) |
88 | is static; |
89 | |
90 | Create (P: Pnt2d; C: Hypr2d; Tol: Real; Uinf: Real; |
91 | Usup: Real) |
92 | returns ExtPElC2d; |
93 | ---Purpose: Calculates the extremum distances between the |
94 | -- point P and the segment [Uinf,Usup] of the hyperbola |
95 | -- C. |
96 | -- Tol is used to determine if two solutions u and v |
97 | -- are identical; the condition is: |
98 | -- dist(C(u),C(v)) < Tol. |
99 | |
100 | Perform(me: in out; P: Pnt2d; C: Hypr2d; Tol: Real; Uinf,Usup: Real) |
101 | is static; |
102 | |
103 | Create (P: Pnt2d; C: Parab2d; Tol: Real; Uinf: Real; |
104 | Usup: Real) |
105 | returns ExtPElC2d; |
106 | ---Purpose: Calculates the 4 extremum distances between the |
107 | -- point P and the segment [Uinf,Usup] of the parabola |
108 | -- C. |
109 | -- Tol is used to determine if two solutions u and v |
110 | -- are identical; the condition is: |
111 | -- dist(C(u),C(v)) < Tol. |
112 | |
113 | Perform(me: in out; P: Pnt2d; C: Parab2d; Tol: Real; Uinf,Usup: Real) |
114 | is static; |
115 | |
116 | |
117 | IsDone (me) returns Boolean |
118 | ---Purpose: True if the distances are found. |
119 | is static; |
120 | |
121 | NbExt (me) returns Integer |
122 | ---Purpose: Returns the number of extremum distances. |
123 | raises NotDone from StdFail |
124 | -- if IsDone(me)=False. |
125 | is static; |
126 | |
127 | SquareDistance (me; N: Integer) returns Real |
128 | ---Purpose: Returns the value of the Nth extremum square distance. |
129 | raises NotDone from StdFail, |
130 | -- if IsDone(me)=False. |
131 | OutOfRange |
132 | -- if N < 1 or N > NbPoints(me). |
133 | is static; |
134 | |
135 | IsMin (me; N: Integer) returns Boolean |
136 | ---Purpose: Returns True if the Nth extremum distance is a |
137 | -- minimum. |
138 | raises NotDone from StdFail, |
139 | -- if IsDone(me)=False. |
140 | OutOfRange |
141 | -- if N < 1 or N > NbPoints(me). |
142 | is static; |
143 | |
144 | Point (me; N: Integer) returns POnCurv2d |
145 | ---Purpose: Returns the point of the Nth extremum distance. |
146 | raises NotDone from StdFail, |
147 | -- if IsDone(me)=False. |
148 | OutOfRange |
149 | -- if N < 1 or N > NbPoints(me). |
150 | is static; |
151 | |
152 | fields |
153 | myDone : Boolean; |
154 | myNbExt: Integer; |
155 | mySqDist: Real [4]; |
156 | myIsMin: Boolean [4]; |
157 | myPoint: POnCurv2d from Extrema [4]; |
158 | |
159 | end ExtPElC2d; |