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
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 -- Modified by skv - Thu Sep 30 15:19:59 2004 OCC593
20 private class FuncExtPS from Extrema
22 inherits FunctionSetWithDerivatives from math
25 -- Functional for search of extremum of the distance between point P and
26 -- surface S, starting from approximate solution (u0, v0).
28 -- The class inherits math_FunctionSetWithDerivatives and thus is intended
29 -- for use in math_FunctionSetRoot algorithm .
31 -- Denoting derivatives of the surface S(u,v) by u and v, respectively, as
32 -- Su and Sv, the two functions to be nullified are:
34 -- F1(u,v) = (S - P) * Su
35 -- F2(u,v) = (S - P) * Sv
37 -- The derivatives of the functional are:
39 -- Duf1(u,v) = Su^2 + (S-P) * Suu;
40 -- Dvf1(u,v) = Su * Sv + (S-P) * Suv
41 -- Duf2(u,v) = Sv * Su + (S-P) * Suv = Dvf1
42 -- Dvf2(u,v) = Sv^2 + (S-P) * Svv
44 -- Here * denotes scalar product, and ^2 is square power.
46 uses POnSurf from Extrema,
47 SequenceOfPOnSurf from Extrema,
48 SequenceOfReal from TColStd,
52 Surface from Adaptor3d,
53 SurfacePtr from Adaptor3d
55 raises OutOfRange from Standard
58 Create returns FuncExtPS;
60 Create (P: Pnt; S: Surface from Adaptor3d) returns FuncExtPS;
63 Initialize(me: in out; S: Surface from Adaptor3d)
64 ---Purpose: sets the field mysurf of the function.
67 SetPoint(me: in out; P: Pnt)
68 ---Purpose: sets the field mysurf of the function.
71 ------------------------------------------------------------
72 -- In all next methods, an exception is raised if the fields
73 -- were not initialized.
75 NbVariables (me) returns Integer;
77 NbEquations (me) returns Integer;
79 Value (me: in out; UV: Vector; F: out Vector) returns Boolean;
80 ---Purpose: Calculate Fi(U,V).
82 Derivatives (me: in out; UV: Vector; DF: out Matrix)
84 ---Purpose: Calculate Fi'(U,V).
86 Values (me: in out; UV: Vector; F: out Vector; DF: out Matrix)
88 ---Purpose: Calculate Fi(U,V) and Fi'(U,V).
90 GetStateNumber (me: in out) returns Integer
91 ---Purpose: Save the found extremum.
94 NbExt (me) returns Integer;
95 ---Purpose: Return the number of found extrema.
97 SquareDistance (me; N: Integer) returns Real
98 ---Purpose: Return the value of the Nth distance.
100 -- if N < 1 or N > NbExt(me).
102 Point (me; N: Integer) returns POnSurf
103 ---C++: return const &
104 ---Purpose: Returns the Nth extremum.
106 -- if N < 1 or N > NbExt(me).
110 myS : SurfacePtr from Adaptor3d;
112 myU : Real; -- current value of U
113 myV : Real; -- current value of V
114 myPs : Pnt from gp; -- current point
116 mySqDist: SequenceOfReal from TColStd;
117 myPoint: SequenceOfPOnSurf from Extrema;