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