1 // Created on: 1995-07-18
2 // Created by: Modelistation
3 // Copyright (c) 1995-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.
18 #include <Adaptor3d_Surface.hxx>
19 #include <Extrema_FuncExtSS.hxx>
20 #include <Extrema_GenLocateExtSS.hxx>
21 #include <Extrema_POnSurf.hxx>
22 #include <math_FunctionSetRoot.hxx>
23 #include <math_NewtonFunctionSetRoot.hxx>
24 #include <math_Vector.hxx>
25 #include <Standard_DomainError.hxx>
26 #include <StdFail_NotDone.hxx>
28 //=======================================================================
29 //function : Extrema_GenLocateExtSS
31 //=======================================================================
32 Extrema_GenLocateExtSS::Extrema_GenLocateExtSS()
36 //=======================================================================
37 //function : Extrema_GenLocateExtSS
39 //=======================================================================
41 Extrema_GenLocateExtSS::Extrema_GenLocateExtSS(const Adaptor3d_Surface& S1,
42 const Adaptor3d_Surface& S2,
43 const Standard_Real U1,
44 const Standard_Real V1,
45 const Standard_Real U2,
46 const Standard_Real V2,
47 const Standard_Real Tol1,
48 const Standard_Real Tol2)
50 Perform(S1,S2,U1,V1,U2,V2,Tol1,Tol2);
53 //=======================================================================
56 //=======================================================================
58 void Extrema_GenLocateExtSS::Perform(const Adaptor3d_Surface& S1,
59 const Adaptor3d_Surface& S2,
60 const Standard_Real U1,
61 const Standard_Real V1,
62 const Standard_Real U2,
63 const Standard_Real V2,
64 const Standard_Real Tol1,
65 const Standard_Real Tol2)
67 myDone = Standard_False;
69 Standard_Real Uinf1, Usup1, Vinf1, Vsup1;
70 Uinf1 = S1.FirstUParameter();
71 Usup1 = S1.LastUParameter();
72 Vinf1 = S1.FirstVParameter();
73 Vsup1 = S1.LastVParameter();
75 Standard_Real Uinf2, Usup2, Vinf2, Vsup2;
76 Uinf2 = S2.FirstUParameter();
77 Usup2 = S2.LastUParameter();
78 Vinf2 = S2.FirstVParameter();
79 Vsup2 = S2.LastVParameter();
81 Extrema_FuncExtSS F (S1,S2);
82 math_Vector Tol(1, 4), Start(1, 4), BInf(1, 4), BSup(1, 4);
103 math_FunctionSetRoot SR (F, Tol);
104 SR.Perform(F, Start, BInf, BSup);
108 mySqDist = F.SquareDistance(1);
109 myPoint1 = F.PointOnS1(1);
110 myPoint2 = F.PointOnS2(1);
111 myDone = Standard_True;
115 //=======================================================================
118 //=======================================================================
120 Standard_Boolean Extrema_GenLocateExtSS::IsDone() const
125 //=======================================================================
128 //=======================================================================
130 Standard_Real Extrema_GenLocateExtSS::SquareDistance() const
132 if (!IsDone()) { throw StdFail_NotDone(); }
136 //=======================================================================
137 //function : PointOnS1
139 //=======================================================================
141 const Extrema_POnSurf& Extrema_GenLocateExtSS::PointOnS1() const
143 if (!IsDone()) { throw StdFail_NotDone(); }
147 //=======================================================================
148 //function : PointOnS2
150 //=======================================================================
152 const Extrema_POnSurf& Extrema_GenLocateExtSS::PointOnS2() const
154 if (!IsDone()) { throw StdFail_NotDone(); }