1 // Created on: 1995-07-18
2 // Created by: Modelistation
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
22 #include <Extrema_GenLocateExtSS.ixx>
24 #include <Extrema_FuncExtSS.hxx>
25 #include <math_Vector.hxx>
26 #include <math_FunctionSetRoot.hxx>
27 #include <math_NewtonFunctionSetRoot.hxx>
29 //=======================================================================
30 //function : Extrema_GenLocateExtSS
32 //=======================================================================
34 Extrema_GenLocateExtSS::Extrema_GenLocateExtSS()
38 //=======================================================================
39 //function : Extrema_GenLocateExtSS
41 //=======================================================================
43 Extrema_GenLocateExtSS::Extrema_GenLocateExtSS(const Adaptor3d_Surface& S1,
44 const Adaptor3d_Surface& S2,
45 const Standard_Real U1,
46 const Standard_Real V1,
47 const Standard_Real U2,
48 const Standard_Real V2,
49 const Standard_Real Tol1,
50 const Standard_Real Tol2)
52 Perform(S1,S2,U1,V1,U2,V2,Tol1,Tol2);
55 //=======================================================================
58 //=======================================================================
60 void Extrema_GenLocateExtSS::Perform(const Adaptor3d_Surface& S1,
61 const Adaptor3d_Surface& S2,
62 const Standard_Real U1,
63 const Standard_Real V1,
64 const Standard_Real U2,
65 const Standard_Real V2,
66 const Standard_Real Tol1,
67 const Standard_Real Tol2)
69 myDone = Standard_False;
71 Standard_Real Uinf1, Usup1, Vinf1, Vsup1;
72 Uinf1 = S1.FirstUParameter();
73 Usup1 = S1.LastUParameter();
74 Vinf1 = S1.FirstVParameter();
75 Vsup1 = S1.LastVParameter();
77 Standard_Real Uinf2, Usup2, Vinf2, Vsup2;
78 Uinf2 = S2.FirstUParameter();
79 Usup2 = S2.LastUParameter();
80 Vinf2 = S2.FirstVParameter();
81 Vsup2 = S2.LastVParameter();
83 Extrema_FuncExtSS F (S1,S2);
84 math_Vector Tol(1, 4), Start(1, 4), BInf(1, 4), BSup(1, 4);
105 math_FunctionSetRoot SR (F, Start,Tol, BInf, BSup);
109 mySqDist = F.SquareDistance(1);
110 myPoint1 = F.PointOnS1(1);
111 myPoint2 = F.PointOnS2(1);
112 myDone = Standard_True;
116 //=======================================================================
119 //=======================================================================
121 Standard_Boolean Extrema_GenLocateExtSS::IsDone() const
126 //=======================================================================
129 //=======================================================================
131 Standard_Real Extrema_GenLocateExtSS::SquareDistance() const
133 if (!IsDone()) { StdFail_NotDone::Raise(); }
137 //=======================================================================
138 //function : PointOnS1
140 //=======================================================================
142 const Extrema_POnSurf& Extrema_GenLocateExtSS::PointOnS1() const
144 if (!IsDone()) { StdFail_NotDone::Raise(); }
148 //=======================================================================
149 //function : PointOnS2
151 //=======================================================================
153 const Extrema_POnSurf& Extrema_GenLocateExtSS::PointOnS2() const
155 if (!IsDone()) { StdFail_NotDone::Raise(); }