diff options
author | Stijn Buys <ingar@osirion.org> | 2008-03-02 12:23:48 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-03-02 12:23:48 +0000 |
commit | 81787e9004377016236865e95b95707ed6cf1d0b (patch) | |
tree | b8a7bd0d51f97848ad98ec8c8f5e424de910df32 /src/math/plane3f.cc | |
parent | 1d45d8ecb4633f07a0ff163255dbedc3c3a72ac8 (diff) |
initial (buggy) support for .map models
Diffstat (limited to 'src/math/plane3f.cc')
-rw-r--r-- | src/math/plane3f.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/math/plane3f.cc b/src/math/plane3f.cc new file mode 100644 index 0000000..232bc98 --- /dev/null +++ b/src/math/plane3f.cc @@ -0,0 +1,32 @@ +/* + math/plane3f.cc + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#include "math/plane3f.h" +#include <string> + +namespace math +{ + +Plane3f::Plane3f(Vector3f const & point0, Vector3f const &point1, Vector3f const &point2) +{ + plane_point[0] = point0; + plane_point[1] = point1; + plane_point[2] = point2; + + plane_normal = crossproduct((plane_point[1] - plane_point[0]) , (plane_point[2] - plane_point[0]) ); + pd = -1 * (plane_normal.x * plane_point[0].x + plane_normal.y * plane_point[0].y + plane_normal.z * plane_point[0].z); +} + +Plane3f::Plane3f(Plane3f const & other) +{ + for (size_t i=0; i < 3; i++) + this->plane_point[i] = other.plane_point[i]; + + plane_normal = crossproduct((plane_point[1] - plane_point[0]) , (plane_point[2] - plane_point[0]) ); + pd = -1 * (plane_normal.x * plane_point[0].x + plane_normal.y * plane_point[0].y + plane_normal.z * plane_point[0].z); +} + +} |