Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: 232bc98ea37989c8ff6f168a40ea7fd315cf4534 (plain)
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
/*
   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);
}

}