diff options
author | FWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544> | 2011-12-08 14:53:40 +0000 |
---|---|---|
committer | FWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544> | 2011-12-08 14:53:40 +0000 |
commit | e33e19d0587146859d48a134ec9fd94e7b7ba5cd (patch) | |
tree | 69d048c8801858d2756ab3a487090a7a1b74bf14 /Opcode/OpcodeLib/Ice/IcePlane.cpp | |
download | starshatter-e33e19d0587146859d48a134ec9fd94e7b7ba5cd.zip starshatter-e33e19d0587146859d48a134ec9fd94e7b7ba5cd.tar.gz starshatter-e33e19d0587146859d48a134ec9fd94e7b7ba5cd.tar.bz2 |
Initial upload
Diffstat (limited to 'Opcode/OpcodeLib/Ice/IcePlane.cpp')
-rw-r--r-- | Opcode/OpcodeLib/Ice/IcePlane.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Opcode/OpcodeLib/Ice/IcePlane.cpp b/Opcode/OpcodeLib/Ice/IcePlane.cpp new file mode 100644 index 0000000..1890f1c --- /dev/null +++ b/Opcode/OpcodeLib/Ice/IcePlane.cpp @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Contains code for planes.
+ * \file IcePlane.cpp
+ * \author Pierre Terdiman
+ * \date April, 4, 2000
+ */
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * IcePlane class.
+ * \class IcePlane
+ * \author Pierre Terdiman
+ * \version 1.0
+ */
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Precompiled Header
+#include "Stdafx.h"
+
+using namespace IceMaths;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Computes the plane equation from 3 points.
+ * \param p0 [in] first point
+ * \param p1 [in] second point
+ * \param p2 [in] third point
+ * \return Self-reference
+ */
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+IcePlane& IcePlane::Set(const IcePoint& p0, const IcePoint& p1, const IcePoint& p2)
+{
+ IcePoint Edge0 = p1 - p0;
+ IcePoint Edge1 = p2 - p0;
+
+ n = Edge0 ^ Edge1;
+ n.Normalize();
+
+ d = -(p0 | n);
+
+ return *this;
+}
|