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
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.
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.
27 uses POnCurv2d from Extrema,
35 raises NotDone from StdFail,
36 OutOfRange from Standard
39 Create returns ExtPElC2d;
41 Create (P: Pnt2d; C: Lin2d; Tol: Real;
42 Uinf: Real; Usup: Real)
44 ---Purpose: Calculates the extremum distance between the
45 -- point P and the segment [Uinf,Usup] of the line L.
48 Perform(me: in out; P: Pnt2d; L: Lin2d; Tol: Real; Uinf,Usup: Real)
51 Create (P: Pnt2d; C: Circ2d; Tol: Real;
52 Uinf: Real; Usup: Real)
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.
67 Perform(me: in out; P: Pnt2d; C: Circ2d; Tol: Real; Uinf,Usup: Real)
70 Create (P: Pnt2d; C: Elips2d; Tol: Real;
71 Uinf: Real; Usup: Real)
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.
87 Perform(me: in out; P: Pnt2d; C: Elips2d; Tol: Real; Uinf,Usup: Real)
90 Create (P: Pnt2d; C: Hypr2d; Tol: Real; Uinf: Real;
93 ---Purpose: Calculates the extremum distances between the
94 -- point P and the segment [Uinf,Usup] of the hyperbola
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.
100 Perform(me: in out; P: Pnt2d; C: Hypr2d; Tol: Real; Uinf,Usup: Real)
103 Create (P: Pnt2d; C: Parab2d; Tol: Real; Uinf: Real;
106 ---Purpose: Calculates the 4 extremum distances between the
107 -- point P and the segment [Uinf,Usup] of the parabola
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.
113 Perform(me: in out; P: Pnt2d; C: Parab2d; Tol: Real; Uinf,Usup: Real)
117 IsDone (me) returns Boolean
118 ---Purpose: True if the distances are found.
121 NbExt (me) returns Integer
122 ---Purpose: Returns the number of extremum distances.
123 raises NotDone from StdFail
124 -- if IsDone(me)=False.
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.
132 -- if N < 1 or N > NbPoints(me).
135 IsMin (me; N: Integer) returns Boolean
136 ---Purpose: Returns True if the Nth extremum distance is a
138 raises NotDone from StdFail,
139 -- if IsDone(me)=False.
141 -- if N < 1 or N > NbPoints(me).
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.
149 -- if N < 1 or N > NbPoints(me).
156 myIsMin: Boolean [4];
157 myPoint: POnCurv2d from Extrema [4];