-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeometry.cpp
More file actions
49 lines (40 loc) · 1019 Bytes
/
Copy pathGeometry.cpp
File metadata and controls
49 lines (40 loc) · 1019 Bytes
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
#include "src/Geometry.h"
namespace geo{
Rectangle::Rectangle():_bound(Vector4f())
{}
Rectangle::Rectangle( Vector4f bound):_bound(bound)
{}
Rectangle::Rectangle( float x, float y, float z , float w ):_bound(Vector4f(x,y,z,w))
{}
Rectangle::~Rectangle()
{}
Vector4f * Rectangle::getBound()
{
return &_bound;
}
BBox::BBox(int width, int length):_width(width),_length(length)
{}
BBox::~BBox()
{}
Sphere::Sphere()
:definition(300)
{
genCircleVertices();
_v=_verts.begin();
}
Sphere::~Sphere(){}
void Sphere::genCircleVertices()
{
float angle1,angle2;
for(angle2=-M_PI/2;angle2<M_PI/2;angle2+=definition){
for(angle1=0.0;angle1<=M_PI*2+definition;angle1+=definition){
_verts.push_back(cos(angle2)*cos(angle1));
_verts.push_back(sin(angle2));
_verts.push_back(cos(angle2)*sin(angle1));
_verts.push_back(cos(angle2+definition)*cos(angle1));
_verts.push_back(sin(angle2+definition));
_verts.push_back(cos(angle2+definition)*sin(angle1));
}
}
}
}//namespace geo