Debian Codegraph @

source/unix/odesrc/OPCODE/Ice/IcePlane.cpp

raw
1 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 /**
3 * Contains code for planes.
4 * \file IcePlane.cpp
5 * \author Pierre Terdiman
6 * \date April, 4, 2000
7 */
8 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
9
10 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
11 /**
12 * Plane class.
13 * \class Plane
14 * \author Pierre Terdiman
15 * \version 1.0
16 */
17 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
18
19 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
20 // Precompiled Header
21 #include "Stdafx.h"
22
23 using namespace IceMaths;
24
25 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
26 /**
27 * Computes the plane equation from 3 points.
28 * \param p0 [in] first point
29 * \param p1 [in] second point
30 * \param p2 [in] third point
31 * \return Self-reference
32 */
33 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
34 Plane& Plane::Set(const Point& p0, const Point& p1, const Point& p2)
35 {
36 Point Edge0 = p1 - p0;
37 Point Edge1 = p2 - p0;
38
39 n = Edge0 ^ Edge1;
40 n.Normalize();
41
42 d = -(p0 | n);
43
44 return *this;
45 }