Warnings on vc14 were eliminated
[occt.git] / src / BRepExtrema / BRepExtrema_ExtPC.cxx
1 // Created on: 1993-12-15
2 // Created by: Christophe MARION
3 // Copyright (c) 1993-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 <BRepExtrema_ExtPC.hxx>
18
19 #include <BRep_Tool.hxx>
20 //#include <StdFail_NotDone.hxx>
21 //#include <Standard_Failure.hxx>
22 #include <BRepAdaptor_Curve.hxx>
23 #include <BRepAdaptor_HCurve.hxx>
24
25
26 //=======================================================================
27 //function : BRepExtrema_ExtPC
28 //purpose  : 
29 //=======================================================================
30
31 BRepExtrema_ExtPC::BRepExtrema_ExtPC(const TopoDS_Vertex& V, const TopoDS_Edge& E)
32 {
33   Initialize(E);
34   Perform(V);
35 }
36
37 //=======================================================================
38 //function : Initialize
39 //purpose  : 
40 //=======================================================================
41
42 void BRepExtrema_ExtPC::Initialize(const TopoDS_Edge& E)
43 {
44   if (!BRep_Tool::IsGeometric(E))
45     return;  // protect against non-geometric type (e.g. polygon)
46   Standard_Real U1, U2;
47   BRepAdaptor_Curve Curv(E);
48   myHC = new BRepAdaptor_HCurve(Curv);
49   Standard_Real Tol = Min(BRep_Tool::Tolerance(E), Precision::Confusion());
50   Tol = Max(Curv.Resolution(Tol), Precision::PConfusion());
51   BRep_Tool::Range(E,U1,U2);
52   myExtPC.Initialize(myHC->Curve(),U1,U2,Tol);
53 }
54
55 //=======================================================================
56 //function : Perform
57 //purpose  : 
58 //=======================================================================
59
60 void BRepExtrema_ExtPC::Perform(const TopoDS_Vertex& V)
61 {
62   if (!myHC.IsNull())
63   {
64     gp_Pnt P = BRep_Tool::Pnt(V);
65     myExtPC.Perform(P);
66   }
67 }