1 -- Created on: 1991-07-24
2 -- Created by: Michel CHAUVAT
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 private generic class FuncExtCC from Extrema
25 Tool1 as any;-- as ToolCurve(Curve1);
27 Tool2 as any;-- as ToolCurve(Curve2);
33 inherits FunctionSetWithDerivatives from math
34 ---Purpose: Function allows finding extrema of the distance between 2 curves.
36 uses Vector from math,
38 SequenceOfReal from TColStd
40 raises OutOfRange from Standard
42 private class SeqPOnC instantiates Sequence from TCollection(POnC);
46 Create (thetol: Real = 1.0e-10) returns FuncExtCC;
49 Create (C1: Curve1; C2: Curve2; thetol: Real = 1.0e-10) returns FuncExtCC;
52 SetCurve (me: in out; theRank: Integer; C1: Curve1);
55 SetTolerance (me: in out; theTol: Real);
59 NbVariables (me) returns Integer is redefined;
62 NbEquations (me) returns Integer is redefined;
65 Value (me: in out; UV: Vector; F: out Vector) returns Boolean is redefined;
66 ---Purpose: Calculate Fi(U,V).
68 Derivatives (me: in out; UV: Vector; DF: out Matrix)
70 ---Purpose: Calculate Fi'(U,V).
72 Values (me: in out; UV: Vector; F: out Vector; DF: out Matrix)
74 ---Purpose: Calculate Fi(U,V) and Fi'(U,V).
76 GetStateNumber (me: in out) returns Integer
77 ---Purpose: Save the found extremum.
80 NbExt (me) returns Integer;
82 ---Purpose: Return the number of found extrema.
84 SquareDistance (me; N: Integer) returns Real
86 ---Purpose: Return the value of the Nth distance.
88 -- if N < 1 or N > NbExt(me).
90 Points (me; N: Integer; P1,P2: out POnC)
91 ---Purpose: Return the points of the Nth extreme distance.
93 -- if N < 1 or N > NbExt(me).
95 CurvePtr (me; theRank: Integer) returns Address;
97 ---Purpose: Returns a pointer to the curve specified in the constructor
98 -- or in SetCurve() method.
100 Tolerance (me) returns Real;
102 ---Purpose: Returns a tolerance specified in the constructor
103 -- or in SetTolerance() method.
105 SubIntervalInitialize(me: in out; theUfirst, theUlast: Vector);
106 ---Purpose: Determines of boundaries of subinterval for find of root.
108 SearchOfTolerance(me: in out; C: Address from Standard) returns Real from Standard;
109 ---Purpose: Computes a Tol value. If 1st derivative of curve
110 -- |D1|<Tol, it is considered D1=0.
114 myC1 : Address from Standard;
115 myC2 : Address from Standard;
119 myP1 : Pnt; -- current point C1(U)
120 myP2 : Pnt; -- current point C2(U)
121 myDu : Vec; -- current D1 C1(U)
122 myDv : Vec; -- current D1 C2(V)
124 mySqDist: SequenceOfReal from TColStd;
127 myTolC1,myTolC2: Real from Standard; -- toolerance for derivate
129 --Supremum of search 1st non-zero derivative
130 myMaxDerivOrderC1, myMaxDerivOrderC2: Integer from Standard;
132 --boundaries of subinterval for find of root
133 myUinfium, myUsupremum: Real from Standard; -- C1 curve
134 myVinfium, myVsupremum: Real from Standard; -- C2 curve