0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / Extrema / Extrema_LocateExtCC2d.cxx
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 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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <Extrema_LocateExtCC2d.hxx>
18
19 #include <GeomAbs_CurveType.hxx>
20 #include <StdFail_NotDone.hxx>
21 #include <Extrema_POnCurv2d.hxx>
22 #include <Precision.hxx>
23
24 #include <Adaptor2d_Curve2d.hxx>
25 #include <Extrema_Curve2dTool.hxx>
26 #include <Extrema_LocECC2d.hxx>
27
28
29 //=======================================================================
30 //function : Extrema_LocateExtCC2d
31 //purpose  : 
32 //=======================================================================
33
34 Extrema_LocateExtCC2d::Extrema_LocateExtCC2d (const Adaptor2d_Curve2d&       C1,
35                                               const Adaptor2d_Curve2d&       C2,
36                                               const Standard_Real U0,
37                                               const Standard_Real V0)
38 : mySqDist(RealLast())
39 {
40   Standard_Real TolU = Extrema_Curve2dTool::Resolution(C1, Precision::Confusion());
41   Standard_Real TolV = Extrema_Curve2dTool::Resolution(C2, Precision::Confusion());
42   Extrema_POnCurv2d P1, P2;
43
44   // Non implemente pour l instant: l appel a Geom2dExtrema_ExtCC.
45
46
47   Extrema_LocECC2d Xtrem(C1, C2, U0, V0, TolU, TolV);   
48   // Exploitation
49
50   myDone = Xtrem.IsDone();
51   if (Xtrem.IsDone()) {
52     mySqDist = Xtrem.SquareDistance();
53     Xtrem.Point(P1, P2);
54     myPoint1 = P1;
55     myPoint2 = P2;
56   }
57
58 }
59
60
61
62
63 //=======================================================================
64 //function : IsDone
65 //purpose  : 
66 //=======================================================================
67
68 Standard_Boolean Extrema_LocateExtCC2d::IsDone () const {
69
70   return myDone;
71 }
72
73
74 //=======================================================================
75 //function : Value
76 //purpose  : 
77 //=======================================================================
78
79 Standard_Real Extrema_LocateExtCC2d::SquareDistance() const {
80
81   if (!IsDone())
82   {
83     throw StdFail_NotDone();
84   }
85   return mySqDist;
86 }
87
88
89
90 //=======================================================================
91 //function : Point
92 //purpose  : 
93 //=======================================================================
94
95 void Extrema_LocateExtCC2d::Point (Extrema_POnCurv2d& P1, 
96                                    Extrema_POnCurv2d& P2) const 
97 {
98   if (!IsDone())
99   {
100     throw StdFail_NotDone();
101   }
102   P1 = myPoint1;
103   P2 = myPoint2;
104 }