1 -- Created on: 1991-02-21
2 -- Created by: Isabelle GRIGNON
3 -- Copyright (c) 1991-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
23 class ExtPElC from Extrema
24 ---Purpose: It calculates all the distances between a point
25 -- and an elementary curve.
26 -- These distances can be minimum or maximum.
28 uses POnCurv from Extrema,
36 raises NotDone from StdFail,
37 OutOfRange from Standard
40 Create returns ExtPElC;
42 Create (P: Pnt; C: Lin; Tol: Real; Uinf,Usup: Real)
44 ---Purpose: Calculates the extremum distance between the
45 -- point P and the segment [Uinf,Usup] of the line C.
47 Perform(me: in out; P: Pnt; C: Lin; Tol: Real; Uinf,Usup: Real)
51 Create (P: Pnt; C: Circ; Tol: Real; Uinf,Usup: Real)
53 ---Purpose: Calculates the 2 extremum distances between the
54 -- point P and the segment [Uinf,Usup] of the circle C.
55 -- Tol is used to determine
56 -- if P is on the axis of the circle or
57 -- if an extremum is on an endpoint of the segment.
58 -- If P is on the axis of the circle,
59 -- there are infinite solution then IsDone(me)=False.
60 -- The conditions on the Uinf and Usup are:
61 -- 0. <= Uinf <= 2.*PI and Usup > Uinf.
62 -- If Usup > Uinf + 2.*PI, then only the solutions in
63 -- the range [Uinf,Uinf+2.*PI[ are computed.
66 Perform(me: in out; P: Pnt; C: Circ; Tol: Real; Uinf,Usup: Real)
69 Create (P: Pnt; C: Elips; Tol: Real; Uinf,Usup: Real)
71 ---Purpose: Calculates the 4 extremum distances between the
72 -- point P and the segment [Uinf,Usup] of the elipse C.
73 -- Tol is used to determine
74 -- if the point is on the axis of the elipse and
75 -- if the major radius is equal to the minor radius or
76 -- if an extremum is on an endpoint of the segment.
77 -- If P is on the axis of the elipse,
78 -- there are infinite solution then IsDone(me)=False.
79 -- The conditions on the Uinf and Usup are:
80 -- 0. <= Uinf <= 2.*PI and Usup > Uinf.
81 -- If Usup > Uinf + 2.*PI, then only the solutions in
82 -- the range [Uinf,Uinf+2.*PI[ are computed.
85 Perform(me: in out; P: Pnt; C: Elips; Tol: Real; Uinf,Usup: Real)
88 Create (P: Pnt; C: Hypr; Tol: Real; Uinf,Usup: Real)
90 ---Purpose: Calculates the extremum distances between the
91 -- point P and the segment [Uinf,Usup] of the hyperbola
93 -- Tol is used to determine if two solutions u and v
94 -- are identical; the condition is:
95 -- dist(C(u),C(v)) < Tol.
97 Perform(me: in out; P: Pnt; C: Hypr; Tol: Real; Uinf,Usup: Real)
100 Create (P: Pnt; C: Parab; Tol: Real; Uinf,Usup: Real)
102 ---Purpose: Calculates the 4 extremum distances between the
103 -- point P and the segment [Uinf,Usup] of the parabola
105 -- Tol is used to determine if two solutions u and v
106 -- are identical; the condition is:
107 -- dist(C(u),C(v)) < Tol.
109 Perform(me: in out; P: Pnt; C: Parab; Tol: Real; Uinf,Usup: Real)
113 IsDone (me) returns Boolean
114 ---Purpose: True if the distances are found.
117 NbExt (me) returns Integer
118 ---Purpose: Returns the number of extremum distances.
119 raises NotDone from StdFail
120 -- if IsDone(me)=False.
123 SquareDistance (me; N: Integer) returns Real
124 ---Purpose: Returns the value of the Nth extremum square distance.
125 raises NotDone from StdFail,
126 -- if IsDone(me)=False.
128 -- if N < 1 or N > NbPoints(me).
131 IsMin (me; N: Integer) returns Boolean
132 ---Purpose: Returns True if the Nth extremum distance is a
134 raises NotDone from StdFail,
135 -- if IsDone(me)=False.
137 -- if N < 1 or N > NbPoints(me).
140 Point (me; N: Integer) returns POnCurv
141 ---C++: return const &
142 ---Purpose: Returns the point of the Nth extremum distance.
143 raises NotDone from StdFail,
144 -- if IsDone(me)=False.
146 -- if N < 1 or N > NbPoints(me).
153 myIsMin: Boolean [4];
154 myPoint: POnCurv from Extrema [4];