Commit | Line | Data |
---|---|---|
b311480e | 1 | -- Created on: 1991-07-24 |
2 | -- Created by: Michel CHAUVAT | |
3 | -- Copyright (c) 1991-1999 Matra Datavision | |
973c2be1 | 4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e | 5 | -- |
973c2be1 | 6 | -- This file is part of Open CASCADE Technology software library. |
b311480e | 7 | -- |
973c2be1 | 8 | -- This library is free software; you can redistribute it and / or modify it |
9 | -- under the terms of the GNU Lesser General Public 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. | |
b311480e | 13 | -- |
973c2be1 | 14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. | |
7fd59977 | 16 | |
17 | private generic class FuncExtCC from Extrema | |
18 | (Curve1 as any; | |
19 | Tool1 as any;-- as ToolCurve(Curve1); | |
20 | Curve2 as any; | |
21 | Tool2 as any;-- as ToolCurve(Curve2); | |
22 | POnC as any; | |
23 | Pnt as any; | |
24 | Vec as any ) | |
25 | ||
26 | ||
27 | inherits FunctionSetWithDerivatives from math | |
0d969553 | 28 | ---Purpose: Function allows finding extrema of the distance between 2 curves. |
7fd59977 | 29 | |
30 | uses Vector from math, | |
31 | Matrix from math, | |
32 | SequenceOfReal from TColStd | |
33 | ||
34 | raises OutOfRange from Standard | |
35 | ||
36 | private class SeqPOnC instantiates Sequence from TCollection(POnC); | |
37 | ||
38 | is | |
39 | ||
40 | Create (thetol: Real = 1.0e-10) returns FuncExtCC; | |
41 | ---Purpose: | |
42 | ||
43 | Create (C1: Curve1; C2: Curve2; thetol: Real = 1.0e-10) returns FuncExtCC; | |
44 | ---Purpose: | |
45 | ||
46 | SetCurve (me: in out; theRank: Integer; C1: Curve1); | |
7fd59977 | 47 | ---Purpose: |
48 | ||
49 | SetTolerance (me: in out; theTol: Real); | |
50 | ---C++: inline | |
51 | ---Purpose: | |
52 | ||
53 | NbVariables (me) returns Integer is redefined; | |
54 | ---C++: inline | |
55 | ||
56 | NbEquations (me) returns Integer is redefined; | |
57 | ---C++: inline | |
58 | ||
59 | Value (me: in out; UV: Vector; F: out Vector) returns Boolean is redefined; | |
0d969553 | 60 | ---Purpose: Calculate Fi(U,V). |
7fd59977 | 61 | |
62 | Derivatives (me: in out; UV: Vector; DF: out Matrix) | |
63 | returns Boolean; | |
0d969553 | 64 | ---Purpose: Calculate Fi'(U,V). |
7fd59977 | 65 | |
66 | Values (me: in out; UV: Vector; F: out Vector; DF: out Matrix) | |
67 | returns Boolean; | |
0d969553 | 68 | ---Purpose: Calculate Fi(U,V) and Fi'(U,V). |
7fd59977 | 69 | |
70 | GetStateNumber (me: in out) returns Integer | |
0d969553 | 71 | ---Purpose: Save the found extremum. |
7fd59977 | 72 | is redefined; |
73 | ||
74 | NbExt (me) returns Integer; | |
75 | ---C++: inline | |
0d969553 | 76 | ---Purpose: Return the number of found extrema. |
7fd59977 | 77 | |
78 | SquareDistance (me; N: Integer) returns Real | |
79 | ---C++: inline | |
0d969553 | 80 | ---Purpose: Return the value of the Nth distance. |
7fd59977 | 81 | raises OutOfRange; |
0d969553 | 82 | -- if N < 1 or N > NbExt(me). |
7fd59977 | 83 | |
84 | Points (me; N: Integer; P1,P2: out POnC) | |
0d969553 | 85 | ---Purpose: Return the points of the Nth extreme distance. |
7fd59977 | 86 | raises OutOfRange; |
0d969553 | 87 | -- if N < 1 or N > NbExt(me). |
7fd59977 | 88 | |
89 | CurvePtr (me; theRank: Integer) returns Address; | |
90 | ---C++: inline | |
91 | ---Purpose: Returns a pointer to the curve specified in the constructor | |
92 | -- or in SetCurve() method. | |
93 | ||
94 | Tolerance (me) returns Real; | |
95 | ---C++: inline | |
96 | ---Purpose: Returns a tolerance specified in the constructor | |
97 | -- or in SetTolerance() method. | |
98 | ||
32ca7a51 | 99 | SubIntervalInitialize(me: in out; theUfirst, theUlast: Vector); |
100 | ---Purpose: Determines of boundaries of subinterval for find of root. | |
101 | ||
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. | |
105 | ||
106 | ||
7fd59977 | 107 | fields |
108 | myC1 : Address from Standard; | |
109 | myC2 : Address from Standard; | |
110 | myTol : Real; | |
0d969553 Y |
111 | myU : Real; |
112 | myV : Real; | |
113 | myP1 : Pnt; -- current point C1(U) | |
114 | myP2 : Pnt; -- current point C2(U) | |
0d167958 RL |
115 | myDu : Vec; -- current D1 C1(U) |
116 | myDv : Vec; -- current D1 C2(V) | |
7fd59977 | 117 | |
118 | mySqDist: SequenceOfReal from TColStd; | |
119 | myPoints: SeqPOnC; | |
120 | ||
32ca7a51 | 121 | myTolC1,myTolC2: Real from Standard; -- toolerance for derivate |
122 | ||
123 | --Supremum of search 1st non-zero derivative | |
124 | myMaxDerivOrderC1, myMaxDerivOrderC2: Integer from Standard; | |
125 | ||
126 | --boundaries of subinterval for find of root | |
127 | myUinfium, myUsupremum: Real from Standard; -- C1 curve | |
128 | myVinfium, myVsupremum: Real from Standard; -- C2 curve | |
129 | ||
130 | ||
7fd59977 | 131 | end FuncExtCC; |