0024134: Wrong result of projection point on the face
[occt.git] / src / Extrema / Extrema_FuncExtPS.cdl
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
21
22 -- Modified by skv - Thu Sep 30 15:19:59 2004 OCC593
23
24
25 private class FuncExtPS from Extrema
26
27  inherits FunctionSetWithDerivatives from math
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. 
50
51 uses    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
60 raises  OutOfRange from Standard
61
62 is
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;
85         ---Purpose: Calculate Fi(U,V).
86
87     Derivatives (me: in out; UV: Vector; DF: out Matrix)
88         returns Boolean;
89         ---Purpose: Calculate Fi'(U,V).
90
91     Values (me: in out; UV: Vector; F: out Vector; DF: out Matrix)
92         returns Boolean;
93         ---Purpose: Calculate Fi(U,V) and Fi'(U,V).
94
95     GetStateNumber (me: in out) returns Integer
96         ---Purpose: Save the found extremum.
97         is redefined;
98
99     NbExt (me) returns Integer;
100         ---Purpose: Return the number of found extrema.
101
102     SquareDistance (me; N: Integer) returns Real
103         ---Purpose: Return the value of the Nth distance.
104         raises  OutOfRange;
105                 -- if N < 1 or N > NbExt(me).
106
107     Point (me; N: Integer) returns POnSurf
108         ---C++: return const &
109         ---Purpose: Returns the Nth extremum.
110         raises  OutOfRange;
111                 -- if N < 1 or N > NbExt(me).
112
113 fields
114     myP    : Pnt from gp;
115     myS    : SurfacePtr from Adaptor3d;
116
117     myU    : Real;          -- current value of U
118     myV    : Real;          -- current value of V
119     myPs   : Pnt from gp;   -- current point
120
121     mySqDist: SequenceOfReal    from TColStd;
122     myPoint: SequenceOfPOnSurf from Extrema;
123     myPinit: Boolean;
124     mySinit: Boolean;
125
126 end FuncExtPS;