Revision 1378,
986 bytes
checked in by giegl, 18 years ago
(diff) |
GTPD - Jungle Rumble - integrate into GTP SVN structure
|
Line | |
---|
1 | #include "dxstdafx.h"
|
---|
2 | #include ".\plane.h"
|
---|
3 |
|
---|
4 | Plane::Plane(void)
|
---|
5 | {
|
---|
6 | }
|
---|
7 |
|
---|
8 | Plane::~Plane(void)
|
---|
9 | {
|
---|
10 | }
|
---|
11 |
|
---|
12 | void Plane::setPoint(Vector p)
|
---|
13 | {
|
---|
14 | this->point = p;
|
---|
15 | }
|
---|
16 |
|
---|
17 | void Plane::setPoint(float _x, float _y, float _z)
|
---|
18 | {
|
---|
19 | this->point.x = _x;
|
---|
20 | this->point.y = _y;
|
---|
21 | this->point.z = _z;
|
---|
22 | }
|
---|
23 |
|
---|
24 | Vector Plane::getPoint()
|
---|
25 | {
|
---|
26 | return this->point;
|
---|
27 | }
|
---|
28 |
|
---|
29 | void Plane::setNormal(Vector &n)
|
---|
30 | {
|
---|
31 | this->normal = n;
|
---|
32 | this->normal.normalize();
|
---|
33 | }
|
---|
34 |
|
---|
35 | void Plane::setNormal(float _nx, float _ny, float _nz)
|
---|
36 | {
|
---|
37 | this->normal.x = _nx;
|
---|
38 | this->normal.y = _ny;
|
---|
39 | this->normal.z = _nz;
|
---|
40 | this->normal.normalize();
|
---|
41 | }
|
---|
42 |
|
---|
43 | Vector Plane::getNormal()
|
---|
44 | {
|
---|
45 | return this->normal;
|
---|
46 | }
|
---|
47 |
|
---|
48 | bool Plane::inFront(Vector p)
|
---|
49 | {
|
---|
50 | Vector diff;
|
---|
51 | diff = p - this->point;
|
---|
52 | diff.normalize();
|
---|
53 | float cosa = diff.dotProd(this->normal);
|
---|
54 | if(cosa>=0)
|
---|
55 | return true;
|
---|
56 | return false;
|
---|
57 | }
|
---|
58 |
|
---|
59 | bool Plane::inFront(float x, float y, float z)
|
---|
60 | {
|
---|
61 | Vector p;
|
---|
62 | p.x = x;
|
---|
63 | p.y = y;
|
---|
64 | p.z = z;
|
---|
65 | return this->inFront(p);
|
---|
66 | }
|
---|
67 |
|
---|
Note: See
TracBrowser
for help on using the repository browser.