Commit | Line | Data |
---|---|---|
7fd59977 | 1 | -- File: FuncExtPS.cdl |
2 | -- Created: Wed Jul 24 14:31:49 1991 | |
3 | -- Author: Michel CHAUVAT | |
4 | -- <mca@topsn3> | |
5 | ---Copyright: Matra Datavision 1991 | |
6 | ||
7 | -- Modified by skv - Thu Sep 30 15:19:59 2004 OCC593 | |
8 | ||
9 | ||
10 | private class FuncExtPS from Extrema | |
11 | ||
12 | inherits FunctionSetWithDerivatives from math | |
6062bf3e G |
13 | ---Purpose: |
14 | -- | |
15 | -- Functional for search of extremum of the distance between point P and | |
16 | -- surface S, starting from approximate solution (u0, v0). | |
17 | -- | |
18 | -- The class inherits math_FunctionSetWithDerivatives and thus is intended | |
19 | -- for use in math_FunctionSetRoot algorithm . | |
20 | -- | |
21 | -- Denoting derivatives of the surface S(u,v) by u and v, respectively, as | |
22 | -- Su and Sv, the two functions to be nullified are: | |
23 | -- | |
24 | -- F1(u,v) = (S - P) * Su | |
25 | -- F2(u,v) = (S - P) * Sv | |
26 | -- | |
27 | -- The derivatives of the functional are: | |
28 | -- | |
29 | -- Duf1(u,v) = Su^2 + (S-P) * Suu; | |
30 | -- Dvf1(u,v) = Su * Sv + (S-P) * Suv | |
31 | -- Duf2(u,v) = Sv * Su + (S-P) * Suv = Dvf1 | |
32 | -- Dvf2(u,v) = Sv^2 + (S-P) * Svv | |
33 | -- | |
34 | -- Here * denotes scalar product, and ^2 is square power. | |
7fd59977 | 35 | |
36 | uses POnSurf from Extrema, | |
37 | SequenceOfPOnSurf from Extrema, | |
38 | SequenceOfReal from TColStd, | |
39 | Pnt from gp, | |
40 | Vector from math, | |
41 | Matrix from math, | |
42 | Surface from Adaptor3d, | |
43 | SurfacePtr from Adaptor3d | |
44 | ||
45 | raises OutOfRange from Standard | |
46 | ||
47 | is | |
48 | Create returns FuncExtPS; | |
49 | ||
50 | Create (P: Pnt; S: Surface from Adaptor3d) returns FuncExtPS; | |
51 | ---Purpose: | |
52 | ||
53 | Initialize(me: in out; S: Surface from Adaptor3d) | |
54 | ---Purpose: sets the field mysurf of the function. | |
55 | is static; | |
56 | ||
57 | SetPoint(me: in out; P: Pnt) | |
58 | ---Purpose: sets the field mysurf of the function. | |
59 | is static; | |
60 | ||
61 | ------------------------------------------------------------ | |
62 | -- In all next methods, an exception is raised if the fields | |
63 | -- were not initialized. | |
64 | ||
65 | NbVariables (me) returns Integer; | |
66 | ||
67 | NbEquations (me) returns Integer; | |
68 | ||
69 | Value (me: in out; UV: Vector; F: out Vector) returns Boolean; | |
0d969553 | 70 | ---Purpose: Calculate Fi(U,V). |
7fd59977 | 71 | |
72 | Derivatives (me: in out; UV: Vector; DF: out Matrix) | |
73 | returns Boolean; | |
0d969553 | 74 | ---Purpose: Calculate Fi'(U,V). |
7fd59977 | 75 | |
76 | Values (me: in out; UV: Vector; F: out Vector; DF: out Matrix) | |
77 | returns Boolean; | |
0d969553 | 78 | ---Purpose: Calculate Fi(U,V) and Fi'(U,V). |
7fd59977 | 79 | |
80 | GetStateNumber (me: in out) returns Integer | |
0d969553 | 81 | ---Purpose: Save the found extremum. |
7fd59977 | 82 | is redefined; |
83 | ||
84 | NbExt (me) returns Integer; | |
0d969553 | 85 | ---Purpose: Return the number of found extrema. |
7fd59977 | 86 | |
87 | SquareDistance (me; N: Integer) returns Real | |
0d969553 | 88 | ---Purpose: Return the value of the Nth distance. |
7fd59977 | 89 | raises OutOfRange; |
0d969553 | 90 | -- if N < 1 or N > NbExt(me). |
7fd59977 | 91 | |
92 | Point (me; N: Integer) returns POnSurf | |
0d969553 | 93 | ---Purpose: Returns the Nth extremum. |
7fd59977 | 94 | raises OutOfRange; |
0d969553 | 95 | -- if N < 1 or N > NbExt(me). |
7fd59977 | 96 | |
7fd59977 | 97 | fields |
98 | myP : Pnt from gp; | |
99 | myS : SurfacePtr from Adaptor3d; | |
100 | ||
0d969553 Y |
101 | myU : Real; -- current value of U |
102 | myV : Real; -- current value of V | |
103 | myPs : Pnt from gp; -- current point | |
7fd59977 | 104 | |
105 | mySqDist: SequenceOfReal from TColStd; | |
106 | myPoint: SequenceOfPOnSurf from Extrema; | |
107 | myPinit: Boolean; | |
108 | mySinit: Boolean; | |
7fd59977 | 109 | |
110 | end FuncExtPS; |