-
Notifications
You must be signed in to change notification settings - Fork 1
/
square.inl
54 lines (44 loc) · 1.03 KB
/
square.inl
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
#ifndef SQUARE_INL
#define SQUARE_INL
#include "square.h"
using namespace pashazz;
void inline Square::setEdge(double e)
{
if (e < 0)
throw NegativeValueException(e, "Pashazz::Square::m_halfedge");
else
m_halfedge = e/2;
}
Point2D inline Square::trCorner() const
{ //top right corner in center coords
return Point2D(m_halfedge, m_halfedge);
}
Point2D inline Square::tlCorner() const
{
return Point2D(-m_halfedge, m_halfedge);
}
Point2D inline Square::blCorner() const
{
return Point2D(-m_halfedge, -m_halfedge);
}
Point2D inline Square::brCorner() const
{
return Point2D(m_halfedge, -m_halfedge);
}
Point2D inline Square::topLeftCorner() const
{
return (-m_centre).translate(tlCorner());
}
Point2D inline Square::topRightCorner() const
{
return (-m_centre).translate(trCorner());
}
Point2D inline Square::bottomLeftCorner() const
{
return (-m_centre).translate(blCorner());
}
Point2D inline Square::bottomRightCorner() const
{
return (-m_centre).translate(brCorner());
}
#endif //SQUARE_INL