0025133: TKOpenGl - Crash on closing a view containing presentations with capping
[occt.git] / src / BRepExtrema / BRepExtrema_ExtPC.cxx
CommitLineData
b311480e 1// Created on: 1993-12-15
2// Created by: Christophe MARION
3// Copyright (c) 1993-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
92d1589b
A
17#include <BRepExtrema_ExtPC.hxx>
18
7fd59977 19#include <BRep_Tool.hxx>
92d1589b
A
20//#include <StdFail_NotDone.hxx>
21//#include <Standard_Failure.hxx>
7fd59977 22#include <BRepAdaptor_Curve.hxx>
23#include <BRepAdaptor_HCurve.hxx>
24
25
26//=======================================================================
27//function : BRepExtrema_ExtPC
28//purpose :
29//=======================================================================
30
92d1589b 31BRepExtrema_ExtPC::BRepExtrema_ExtPC(const TopoDS_Vertex& V, const TopoDS_Edge& E)
7fd59977 32{
33 Initialize(E);
34 Perform(V);
35}
36
37//=======================================================================
38//function : Initialize
39//purpose :
40//=======================================================================
41
42void BRepExtrema_ExtPC::Initialize(const TopoDS_Edge& E)
43{
44 Standard_Real U1,U2;
45 BRepAdaptor_Curve Curv(E);
46 myHC = new BRepAdaptor_HCurve(Curv);
0e4e1240 47 Standard_Real Tol = Min(BRep_Tool::Tolerance(E), Precision::Confusion());
48 Tol = Max(Curv.Resolution(Tol), Precision::PConfusion());
7fd59977 49 BRep_Tool::Range(E,U1,U2);
0e4e1240 50 myExtPC.Initialize(myHC->Curve(),U1,U2,Tol);
7fd59977 51}
52
53//=======================================================================
54//function : Perform
55//purpose :
56//=======================================================================
57
58void BRepExtrema_ExtPC::Perform(const TopoDS_Vertex& V)
59{
60 gp_Pnt P = BRep_Tool::Pnt(V);
92d1589b 61 myExtPC.Perform(P);
7fd59977 62}