0024754: Remove constructor for static class TopOpeBRep_PointGeomTool
[occt.git] / src / TopOpeBRep / TopOpeBRep_PointGeomTool.cxx
CommitLineData
b311480e 1// Created on: 1994-10-25
2// Created by: Jean Yves LEBEY
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
17#include <TopOpeBRep_PointGeomTool.ixx>
18#include <TopOpeBRep_Point2d.hxx>
19#include <TopoDS.hxx>
20#include <TopoDS_Edge.hxx>
21#include <BRep_Tool.hxx>
22
7fd59977 23//=======================================================================
24//function : MakePoint
25//purpose :
26//=======================================================================
27TopOpeBRepDS_Point TopOpeBRep_PointGeomTool::MakePoint
28(const TopOpeBRep_VPointInter& IP)
29{
30 Standard_Real tolip = IP.Tolerance();
31 Standard_Real tolout = tolip;
32 Standard_Integer si = IP.ShapeIndex();
33 if ( si == 0 ) {
34 tolout = tolip;
35 } else if ( si == 1 ) {
36 const TopoDS_Edge& E = TopoDS::Edge(IP.Edge(si));
37 tolout = BRep_Tool::Tolerance(E);
38 } else if ( si == 2 ) {
39 const TopoDS_Edge& E = TopoDS::Edge(IP.Edge(si));
40 tolout = BRep_Tool::Tolerance(E);
41 } else if ( si == 3 ) {
42 const TopoDS_Edge& E1 = TopoDS::Edge(IP.Edge(1));
43 const TopoDS_Edge& E2 = TopoDS::Edge(IP.Edge(2));
44 Standard_Real t1 = BRep_Tool::Tolerance(E1);
45 Standard_Real t2 = BRep_Tool::Tolerance(E2);
46 // tolout = Max(t1,t2);
47 if (t1 > 0.9) t1 = 0.9;
48 if (t1 > 0.9) t1 = 0.9;
49 tolout = 2.5*(t1+t2);
50 }
51 tolout = Max(tolout,tolip);
52 return TopOpeBRepDS_Point(IP.Value(),tolout);
53}
54
55//=======================================================================
56//function : MakePoint
57//purpose :
58//=======================================================================
59TopOpeBRepDS_Point TopOpeBRep_PointGeomTool::MakePoint
60(const TopOpeBRep_Point2d& P2D)
61{
62 Standard_Real tol = P2D.Tolerance();
63 return TopOpeBRepDS_Point(P2D.Value(),tol);
64}
65
66//=======================================================================
67//function : MakePoint
68//purpose :
69//=======================================================================
70TopOpeBRepDS_Point TopOpeBRep_PointGeomTool::MakePoint
71(const TopOpeBRep_FaceEdgeIntersector& FEI)
72{
73 Standard_Real tol = FEI.Tolerance();
74 return TopOpeBRepDS_Point(FEI.Value(),tol);
75}
76
77//=======================================================================
78//function : MakePoint
79//purpose :
80//=======================================================================
81TopOpeBRepDS_Point TopOpeBRep_PointGeomTool::MakePoint
82(const TopoDS_Shape& S)
83{
84 return TopOpeBRepDS_Point(S);
85}
86
87//=======================================================================
88//function : IsEqual
89//purpose :
90//=======================================================================
91Standard_Boolean TopOpeBRep_PointGeomTool::IsEqual
92(const TopOpeBRepDS_Point& DSP1,
93 const TopOpeBRepDS_Point& DSP2)
94{
95 Standard_Boolean b = DSP1.IsEqual(DSP2);
96 return b;
97}