0024001: Stereographic rendering support
[occt.git] / src / Extrema / Extrema_GLocateExtCC.gxx
1 // Created on: 1994-07-06
2 // Created by: Laurent PAINNOT
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include Extrema_ELCC_hxx
18 #include Extrema_LocECC_hxx
19 #include <StdFail_NotDone.hxx>
20 #include <Extrema_POnCurv.hxx>
21 #include <Precision.hxx>
22
23 Extrema_GLocateExtCC::Extrema_GLocateExtCC (const Curve1&       C1,
24                                             const Curve2&       C2,
25                                             const Standard_Real U0,
26                                             const Standard_Real V0)
27 {
28   Standard_Real TolU = C1.Resolution(Precision::Confusion());
29   Standard_Real TolV = C2.Resolution(Precision::Confusion());
30   Extrema_POnCurv P1, P2;
31
32   // Non implemente pour l instant: l appel a Extrema_ELCC.
33
34
35   Extrema_LocECC Xtrem(C1, C2,
36                        U0, V0, TolU, TolV);     
37   // Exploitation
38
39   myDone = Xtrem.IsDone();
40   if (Xtrem.IsDone()) {
41     mySqDist = Xtrem.SquareDistance();
42     Xtrem.Point(P1, P2);
43     myPoint1 = P1;
44     myPoint2 = P2;
45   }
46
47 }
48
49
50
51
52 Standard_Boolean Extrema_GLocateExtCC::IsDone () const {
53
54   return myDone;
55 }
56
57
58 Standard_Real Extrema_GLocateExtCC::SquareDistance() const {
59
60   if (!myDone) { StdFail_NotDone::Raise(); }
61   return mySqDist;
62 }
63
64
65
66 void Extrema_GLocateExtCC::Point (Extrema_POnCurv& P1, Extrema_POnCurv& P2) const {
67
68   if (!myDone) { StdFail_NotDone::Raise(); }
69   P1 = myPoint1;
70   P2 = myPoint2;
71 }
72