-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShapes.cpp
More file actions
70 lines (60 loc) · 1.29 KB
/
Shapes.cpp
File metadata and controls
70 lines (60 loc) · 1.29 KB
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
/*****************************************************************************/
/*!
\file Shapes.cpp
\author Yeongki Baek
\par email: yeongki.baek\@digipen.edu
\date 08/01/2017
\brief
This is the interface file for the module
Copyright 2017, Digipen Institute of Technology
*/
/*****************************************************************************/
#include "Precompiled.hpp"
#include "Shapes.hpp"
namespace HOLD
{
Box::Box()
{
//set the aabb to an initial bad value (where the min is smaller than the max)
/*mMin.Splat(Math::PositiveMax());
mMax.Splat(-Math::PositiveMax());*/
mMin.x = Math::PositiveMax();
mMin.y = Math::PositiveMin();
mMax.x = Math::PositiveMax();
mMax.y = Math::PositiveMin();
}
Box::Box(const Vector2& min, const Vector2& max)
{
mMin = min;
mMax = max;
}
Vector2 Box::GetMin() const
{
return mMin;
}
Vector2 Box::GetMax() const
{
return mMax;
}
Vector2 Box::GetCenter() const
{
return (mMin + mMax) * 0.5f;
}
Vector2 Box::GetHalfSize() const
{
return (mMax - mMin) * 0.5f;
}
Ray::Ray()
{
mStart = mDirection = Vector2::cZero;
}
Ray::Ray(Math::Vec2Param start, Math::Vec2Param dir)
{
mStart = start;
mDirection = dir;
}
Vector2 Ray::GetPoint(float t) const
{
return mStart + mDirection * t;
}
}// namespace HOLD