0024001: Stereographic rendering support
[occt.git] / src / Extrema / Extrema_GLocateExtCC2d.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_ELCC2d_hxx
18 #include Extrema_LocECC2d_hxx
19 #include <GeomAbs_CurveType.hxx>
20 #include <StdFail_NotDone.hxx>
21 #include <Extrema_POnCurv2d.hxx>
22 #include <Precision.hxx>
23
24
25 //=======================================================================
26 //function : Extrema_GLocateExtCC2d
27 //purpose  : 
28 //=======================================================================
29
30 Extrema_GLocateExtCC2d::Extrema_GLocateExtCC2d (const Curve1&       C1,
31                                                 const Curve2&       C2,
32                                                 const Standard_Real U0,
33                                                 const Standard_Real V0)
34 {
35   Standard_Real TolU = Tool1::Resolution(C1, Precision::Confusion());
36   Standard_Real TolV = Tool2::Resolution(C2, Precision::Confusion());
37   Extrema_POnCurv2d P1, P2;
38
39   // Non implemente pour l instant: l appel a Geom2dExtrema_ExtCC.
40
41
42   Extrema_LocECC2d Xtrem(C1, C2, U0, V0, TolU, TolV);   
43   // Exploitation
44
45   myDone = Xtrem.IsDone();
46   if (Xtrem.IsDone()) {
47     mySqDist = Xtrem.SquareDistance();
48     Xtrem.Point(P1, P2);
49     myPoint1 = P1;
50     myPoint2 = P2;
51   }
52
53 }
54
55
56
57
58 //=======================================================================
59 //function : IsDone
60 //purpose  : 
61 //=======================================================================
62
63 Standard_Boolean Extrema_GLocateExtCC2d::IsDone () const {
64
65   return myDone;
66 }
67
68
69 //=======================================================================
70 //function : Value
71 //purpose  : 
72 //=======================================================================
73
74 Standard_Real Extrema_GLocateExtCC2d::SquareDistance() const {
75
76   if (!myDone) { StdFail_NotDone::Raise(); }
77   return mySqDist;
78 }
79
80
81
82 //=======================================================================
83 //function : Point
84 //purpose  : 
85 //=======================================================================
86
87 void Extrema_GLocateExtCC2d::Point (Extrema_POnCurv2d& P1, 
88                                     Extrema_POnCurv2d& P2) const 
89 {
90   if (!myDone) { StdFail_NotDone::Raise(); }
91   P1 = myPoint1;
92   P2 = myPoint2;
93 }