diff options
author | Stijn Buys <ingar@osirion.org> | 2008-05-04 22:30:49 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-05-04 22:30:49 +0000 |
commit | 7218e3bd4616d4706090ec47d72845a2bb89c6a3 (patch) | |
tree | cbf3fdb0dddf573edff89b50af22e8a84690cf00 /src/model/plane.cc | |
parent | 33e45d8052b385aa8b1fce68122c8d11f50e7e42 (diff) |
split map reading from models
Diffstat (limited to 'src/model/plane.cc')
-rw-r--r-- | src/model/plane.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/model/plane.cc b/src/model/plane.cc new file mode 100644 index 0000000..2d548ce --- /dev/null +++ b/src/model/plane.cc @@ -0,0 +1,37 @@ +/* + model/plane.cc + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#include <string> + +#include "model/plane.h" + +namespace model +{ + +using math::Vector3f; + +Plane::Plane(Vector3f const & point0, Vector3f const &point1, Vector3f const &point2) +{ + plane_detail = false; + + 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); +} + +Plane::Plane(Plane 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); +} + +} |