1 // Created on: 1996-01-25
2 // Created by: Laurent PAINNOT
3 // Copyright (c) 1996-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 under
9 // the terms of the GNU Lesser General Public License 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 #include <Extrema_GenLocateExtCS.ixx>
19 #include <Extrema_FuncExtCS.hxx>
20 #include <math_Vector.hxx>
21 #include <math_FunctionSetRoot.hxx>
22 #include <math_NewtonFunctionSetRoot.hxx>
24 //=======================================================================
25 //function : Extrema_GenLocateExtCS
27 //=======================================================================
29 Extrema_GenLocateExtCS::Extrema_GenLocateExtCS()
33 //=======================================================================
34 //function : Extrema_GenLocateExtCS
36 //=======================================================================
38 Extrema_GenLocateExtCS::Extrema_GenLocateExtCS(const Adaptor3d_Curve& C,
39 const Adaptor3d_Surface& S,
40 const Standard_Real T,
41 const Standard_Real U,
42 const Standard_Real V,
43 const Standard_Real Tol1,
44 const Standard_Real Tol2)
46 Perform(C,S,T,U,V,Tol1,Tol2);
49 //=======================================================================
52 //=======================================================================
54 void Extrema_GenLocateExtCS::Perform(const Adaptor3d_Curve& C,
55 const Adaptor3d_Surface& S,
56 const Standard_Real T,
57 const Standard_Real U,
58 const Standard_Real V,
59 const Standard_Real Tol1,
60 const Standard_Real Tol2)
62 myDone = Standard_False;
64 Standard_Real Tinf, Tsup;
65 Tinf = C.FirstParameter();
66 Tsup = C.LastParameter();
68 Standard_Real Uinf, Usup, Vinf, Vsup;
69 Uinf = S.FirstUParameter();
70 Usup = S.LastUParameter();
71 Vinf = S.FirstVParameter();
72 Vsup = S.LastVParameter();
74 Extrema_FuncExtCS F (C,S);
75 math_Vector Tol(1, 3), Start(1, 3), BInf(1, 3), BSup(1, 3);
92 math_FunctionSetRoot SR (F, Tol);
93 SR.Perform(F, Start, BInf, BSup);
97 mySqDist = F.SquareDistance(1);
98 myPoint1 = F.PointOnCurve(1);
99 myPoint2 = F.PointOnSurface(1);
100 myDone = Standard_True;
104 //=======================================================================
107 //=======================================================================
109 Standard_Boolean Extrema_GenLocateExtCS::IsDone() const
114 //=======================================================================
117 //=======================================================================
119 Standard_Real Extrema_GenLocateExtCS::SquareDistance() const
121 if (!IsDone()) { StdFail_NotDone::Raise(); }
125 //=======================================================================
126 //function : PointOnCurve
128 //=======================================================================
130 const Extrema_POnCurv& Extrema_GenLocateExtCS::PointOnCurve() const
132 if (!IsDone()) { StdFail_NotDone::Raise(); }
136 //=======================================================================
137 //function : PointOnSurface
139 //=======================================================================
141 const Extrema_POnSurf& Extrema_GenLocateExtCS::PointOnSurface() const
143 if (!IsDone()) { StdFail_NotDone::Raise(); }