-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathGeom2d_Edge.cxx
99 lines (86 loc) · 1.75 KB
/
Geom2d_Edge.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/**
* \file Geom2d_Edge.cxx
* \brief Implementation file for the class Geom2d_Edge
* \author <a href="mailto:[email protected]?subject=Geom2d_Edge.cxx">Sergei Maslov</a>
*/
#include "Geom2d_Edge.hxx"
IMPLEMENT_STANDARD_RTTIEXT(Geom2d_Edge, Geom2d_Line)
/**
* \fn Geom2d_Edge()
* \brief Constructs a Geom2d_Edge
*/
Geom2d_Edge::Geom2d_Edge()
:Geom2d_Line (gp::Origin2d(),gp::DX2d())
{
}
/**
* \fn ~Geom2d_Edge()
* \brief destructor
*/
Geom2d_Edge::~Geom2d_Edge()
{
}
/**
* \fn SetPoints(const gp_Pnt2d& p1,const gp_Pnt2d& p2)
* \brief set edge by 2 points
* \return Standard_Boolean
* \param p1 const gp_Pnt2d&
* \param p2 const gp_Pnt2d&
*/
Standard_Boolean Geom2d_Edge::SetPoints(const gp_Pnt2d& p1,const gp_Pnt2d& p2)
{
if (!p1.IsEqual(p2,0))
{
SetDirection(gp_Dir2d(gp_Vec2d(p1,p2)));
SetLocation(p1);
StartPnt = p1;
EndPnt = p2;
return Standard_True;
}
else return Standard_False;
}
/**
* \fn GetStart_Pnt()
* \brief get start 2d point
* \return gp_Pnt2d const
*/
gp_Pnt2d Geom2d_Edge::GetStart_Pnt() const
{
return StartPnt;
}
/**
* \fn GetEnd_Pnt()
* \brief get end 2d point
* \return gp_Pnt2d const
*/
gp_Pnt2d Geom2d_Edge::GetEnd_Pnt() const
{
return EndPnt;
}
/**
* \fn MiddlePnt()
* \brief get middle 2d point
* \return gp_Pnt2d const
*/
gp_Pnt2d Geom2d_Edge::MiddlePnt() const
{
return StartPnt.Scaled(EndPnt,0.5);
}
/**
* \fn StartParameter()
* \brief get parameter of start 2d point
* \return Standard_Real const
*/
Standard_Real Geom2d_Edge::StartParameter() const
{
return ElCLib::Parameter(Lin2d(),StartPnt);
}
/**
* \fn EndParameter()
* \brief get parameter of end 2d point
* \return Standard_Real const
*/
Standard_Real Geom2d_Edge::EndParameter() const
{
return ElCLib::Parameter(Lin2d(),EndPnt);
}