1 -- Created on: 1993-12-14
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.
23 generic class GLocateExtPC from Extrema(
30 TheSequenceOfPOnC as any)
32 ---Purpose: It calculates the distance between a point and a
33 -- curve with a close point.
34 -- This distance can be a minimum or a maximum.
36 uses CurveType from GeomAbs
39 raises DomainError from Standard,
42 class ELPC instantiates GExtPC from Extrema
52 class LocEPC instantiates GenLocateExtPC from Extrema
62 Create returns GLocateExtPC;
64 Create (P: ThePoint; C: TheCurve; U0: Real; TolF: Real)
66 ---Purpose: Calculates the distance with a close point.
67 -- The close point is defined by the parameter value
69 -- The function F(u)=distance(P,C(u)) has an extremum
70 -- when g(u)=dF/du=0. The algorithm searchs a zero
71 -- near the close point.
72 -- TolF is used to decide to stop the iterations.
73 -- At the nth iteration, the criteria is:
74 -- abs(Un - Un-1) < TolF.
76 -- if U0 is outside the definition range of the curve.
79 Create (P: ThePoint; C: TheCurve; U0: Real; Umin, Usup: Real; TolF: Real)
81 ---Purpose: Calculates the distance with a close point.
82 -- The close point is defined by the parameter value
84 -- The function F(u)=distance(P,C(u)) has an extremum
85 -- when g(u)=dF/du=0. The algorithm searchs a zero
86 -- near the close point.
87 -- Zeros are searched between Umin et Usup.
88 -- TolF is used to decide to stop the iterations.
89 -- At the nth iteration, the criteria is:
90 -- abs(Un - Un-1) < TolF.
92 -- if U0 is outside the definition range of the curve.
94 Initialize(me: in out; C: TheCurve; Umin, Usup: Real; TolF: Real)
95 ---Purpose: sets the fields of the algorithm.
99 Perform(me: in out; P: ThePoint; U0: Real)
105 IsDone (me) returns Boolean
106 ---Purpose: Returns True if the distance is found.
109 SquareDistance (me) returns Real
110 ---Purpose: Returns the value of the extremum square distance.
111 raises NotDone from StdFail
112 -- if IsDone(me)=False.
115 IsMin (me) returns Boolean
116 ---Purpose: Returns True if the extremum distance is a minimum.
117 raises NotDone from StdFail
118 -- if IsDone(me)=False.
121 Point (me) returns ThePOnC
122 ---Purpose: Returns the point of the extremum distance.
123 raises NotDone from StdFail
124 -- if IsDone(me)=False.
131 myC: Address from Standard;
132 mydist2: Real from Standard;
133 myismin: Boolean from Standard;
134 myDone : Boolean from Standard;
135 myumin: Real from Standard;
136 myusup: Real from Standard;
137 mytol: Real from Standard;
138 myLocExtPC: LocEPC from Extrema;
139 myExtremPC: ELPC from Extrema;
140 type: CurveType from GeomAbs;
141 numberext: Integer from Standard;