0024200: Wrong result obtained by Exterma Curve/Curve
[occt.git] / src / Extrema / Extrema_GLocateExtPC.cdl
CommitLineData
b311480e 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
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
23generic class GLocateExtPC from Extrema(
24 TheCurve as any;
25 TheCurveTool as any;
26 TheExtPElC as any;
27 ThePoint as any;
28 TheVector as any;
29 ThePOnC as any;
30 TheSequenceOfPOnC as any)
31
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.
35
36uses CurveType from GeomAbs
37
38
39raises DomainError from Standard,
40 NotDone from StdFail
41
42 class ELPC instantiates GExtPC from Extrema
43 (TheCurve,
44 TheCurveTool,
45 TheExtPElC,
46 ThePoint,
47 TheVector,
48 ThePOnC,
49 TheSequenceOfPOnC);
50
51
52 class LocEPC instantiates GenLocateExtPC from Extrema
53 (TheCurve,
54 TheCurveTool,
55 ThePOnC,
56 ThePoint,
57 TheVector);
58
59
60is
61
62 Create returns GLocateExtPC;
63
64 Create (P: ThePoint; C: TheCurve; U0: Real; TolF: Real)
65 returns GLocateExtPC
66 ---Purpose: Calculates the distance with a close point.
67 -- The close point is defined by the parameter value
68 -- U0.
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.
75 raises DomainError;
76 -- if U0 is outside the definition range of the curve.
77
78
79 Create (P: ThePoint; C: TheCurve; U0: Real; Umin, Usup: Real; TolF: Real)
80 returns GLocateExtPC
81 ---Purpose: Calculates the distance with a close point.
82 -- The close point is defined by the parameter value
83 -- U0.
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.
91 raises DomainError;
92 -- if U0 is outside the definition range of the curve.
93
94 Initialize(me: in out; C: TheCurve; Umin, Usup: Real; TolF: Real)
95 ---Purpose: sets the fields of the algorithm.
96 is static;
97
98
99 Perform(me: in out; P: ThePoint; U0: Real)
100 ---Purpose:
101
102 is static;
103
104
105 IsDone (me) returns Boolean
106 ---Purpose: Returns True if the distance is found.
107 is static;
108
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.
113 is static;
114
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.
119 is static;
120
121 Point (me) returns ThePOnC
5d99f2c8 122 ---C++: return const &
7fd59977 123 ---Purpose: Returns the point of the extremum distance.
124 raises NotDone from StdFail
125 -- if IsDone(me)=False.
126 is static;
127
128
129
130fields
131 mypp: ThePOnC;
132 myC: Address from Standard;
133 mydist2: Real from Standard;
134 myismin: Boolean from Standard;
135 myDone : Boolean from Standard;
136 myumin: Real from Standard;
137 myusup: Real from Standard;
138 mytol: Real from Standard;
139 myLocExtPC: LocEPC from Extrema;
140 myExtremPC: ELPC from Extrema;
141 type: CurveType from GeomAbs;
142 numberext: Integer from Standard;
143
144end GLocateExtPC;