| 1 |
// |
| 2 |
// plane.h |
| 3 |
// CubicVR2 |
| 4 |
// |
| 5 |
// Created by Charles J. Cliffe on 2013-02-22. |
| 6 |
// Copyright (c) 2013 Charles J. Cliffe. All rights reserved. |
| 7 |
// |
| 8 |
|
| 9 |
#ifndef CubicVR2_plane_h |
| 10 |
#define CubicVR2_plane_h |
| 11 |
|
| 12 |
#include "vec4.h" |
| 13 |
#include "vec3.h" |
| 14 |
|
| 15 |
namespace CubicVR { |
| 16 |
|
| 17 |
struct plane : vec4 { |
| 18 |
static int classifyPoint(vec4 plane, vec3 pt) { |
| 19 |
__float dist = (plane[0] * pt[0]) + (plane[1] * pt[1]) + (plane[2] * pt[2]) + (plane[3]); |
| 20 |
if (dist < 0) { |
| 21 |
return -1; |
| 22 |
} |
| 23 |
else if (dist > 0) { |
| 24 |
return 1; |
| 25 |
} |
| 26 |
return 0; |
| 27 |
}; |
| 28 |
}; |
| 29 |
|
| 30 |
} |
| 31 |
|
| 32 |
#endif |