diff options
Diffstat (limited to 'Opcode/Ice/IcePlane.cpp')
-rw-r--r-- | Opcode/Ice/IcePlane.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Opcode/Ice/IcePlane.cpp b/Opcode/Ice/IcePlane.cpp new file mode 100644 index 0000000..cd4758c --- /dev/null +++ b/Opcode/Ice/IcePlane.cpp @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Contains code for planes.
+ * \file IcePlane.cpp
+ * \author Pierre Terdiman
+ * \date April, 4, 2000
+ */
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Plane class.
+ * \class Plane
+ * \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 IcePoint
+ * \param p1 [in] second IcePoint
+ * \param p2 [in] third IcePoint
+ * \return Self-reference
+ */
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Plane& Plane::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;
+}
|