1 -- Created on: 1991-07-24
2 -- Created by: Michel CHAUVAT
3 -- Copyright (c) 1991-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 private generic class FuncExtCC from Extrema
19 Tool1 as any;-- as ToolCurve(Curve1);
21 Tool2 as any;-- as ToolCurve(Curve2);
27 inherits FunctionSetWithDerivatives from math
28 ---Purpose: Function allows finding extrema of the distance between 2 curves.
30 uses Vector from math,
32 SequenceOfReal from TColStd
34 raises OutOfRange from Standard
36 private class SeqPOnC instantiates Sequence from TCollection(POnC);
40 Create (thetol: Real = 1.0e-10) returns FuncExtCC;
43 Create (C1: Curve1; C2: Curve2; thetol: Real = 1.0e-10) returns FuncExtCC;
46 SetCurve (me: in out; theRank: Integer; C1: Curve1);
49 SetTolerance (me: in out; theTol: Real);
53 NbVariables (me) returns Integer is redefined;
56 NbEquations (me) returns Integer is redefined;
59 Value (me: in out; UV: Vector; F: out Vector) returns Boolean is redefined;
60 ---Purpose: Calculate Fi(U,V).
62 Derivatives (me: in out; UV: Vector; DF: out Matrix)
64 ---Purpose: Calculate Fi'(U,V).
66 Values (me: in out; UV: Vector; F: out Vector; DF: out Matrix)
68 ---Purpose: Calculate Fi(U,V) and Fi'(U,V).
70 GetStateNumber (me: in out) returns Integer
71 ---Purpose: Save the found extremum.
74 NbExt (me) returns Integer;
76 ---Purpose: Return the number of found extrema.
78 SquareDistance (me; N: Integer) returns Real
80 ---Purpose: Return the value of the Nth distance.
82 -- if N < 1 or N > NbExt(me).
84 Points (me; N: Integer; P1,P2: out POnC)
85 ---Purpose: Return the points of the Nth extreme distance.
87 -- if N < 1 or N > NbExt(me).
89 CurvePtr (me; theRank: Integer) returns Address;
91 ---Purpose: Returns a pointer to the curve specified in the constructor
92 -- or in SetCurve() method.
94 Tolerance (me) returns Real;
96 ---Purpose: Returns a tolerance specified in the constructor
97 -- or in SetTolerance() method.
99 SubIntervalInitialize(me: in out; theUfirst, theUlast: Vector);
100 ---Purpose: Determines of boundaries of subinterval for find of root.
102 SearchOfTolerance(me: in out; C: Address from Standard) returns Real from Standard;
103 ---Purpose: Computes a Tol value. If 1st derivative of curve
104 -- |D1|<Tol, it is considered D1=0.
108 myC1 : Address from Standard;
109 myC2 : Address from Standard;
113 myP1 : Pnt; -- current point C1(U)
114 myP2 : Pnt; -- current point C2(U)
115 myDu : Vec; -- current D1 C1(U)
116 myDv : Vec; -- current D1 C2(V)
118 mySqDist: SequenceOfReal from TColStd;
121 myTolC1,myTolC2: Real from Standard; -- toolerance for derivate
123 --Supremum of search 1st non-zero derivative
124 myMaxDerivOrderC1, myMaxDerivOrderC2: Integer from Standard;
126 --boundaries of subinterval for find of root
127 myUinfium, myUsupremum: Real from Standard; -- C1 curve
128 myVinfium, myVsupremum: Real from Standard; -- C2 curve