0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / Extrema / Extrema_LocateExtCC2d.cxx
CommitLineData
b311480e 1// Created on: 1994-07-06
2// Created by: Laurent PAINNOT
3// Copyright (c) 1994-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
0b85f9a6 17#include <Extrema_LocateExtCC2d.hxx>
18
7fd59977 19#include <GeomAbs_CurveType.hxx>
20#include <StdFail_NotDone.hxx>
21#include <Extrema_POnCurv2d.hxx>
22#include <Precision.hxx>
23
0b85f9a6 24#include <Adaptor2d_Curve2d.hxx>
25#include <Extrema_Curve2dTool.hxx>
26#include <Extrema_LocECC2d.hxx>
27
7fd59977 28
29//=======================================================================
0b85f9a6 30//function : Extrema_LocateExtCC2d
7fd59977 31//purpose :
32//=======================================================================
33
0b85f9a6 34Extrema_LocateExtCC2d::Extrema_LocateExtCC2d (const Adaptor2d_Curve2d& C1,
35 const Adaptor2d_Curve2d& C2,
36 const Standard_Real U0,
37 const Standard_Real V0)
d533dafb 38: mySqDist(RealLast())
7fd59977 39{
0b85f9a6 40 Standard_Real TolU = Extrema_Curve2dTool::Resolution(C1, Precision::Confusion());
41 Standard_Real TolV = Extrema_Curve2dTool::Resolution(C2, Precision::Confusion());
7fd59977 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
0b85f9a6 68Standard_Boolean Extrema_LocateExtCC2d::IsDone () const {
7fd59977 69
70 return myDone;
71}
72
73
74//=======================================================================
75//function : Value
76//purpose :
77//=======================================================================
78
0b85f9a6 79Standard_Real Extrema_LocateExtCC2d::SquareDistance() const {
7fd59977 80
638ad7f3 81 if (!IsDone())
82 {
83 throw StdFail_NotDone();
84 }
7fd59977 85 return mySqDist;
86}
87
88
89
90//=======================================================================
91//function : Point
92//purpose :
93//=======================================================================
94
0b85f9a6 95void Extrema_LocateExtCC2d::Point (Extrema_POnCurv2d& P1,
96 Extrema_POnCurv2d& P2) const
7fd59977 97{
638ad7f3 98 if (!IsDone())
99 {
100 throw StdFail_NotDone();
101 }
7fd59977 102 P1 = myPoint1;
103 P2 = myPoint2;
104}