mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-26 14:55:39 +00:00
Engine directory for ticket #1
This commit is contained in:
parent
352279af7a
commit
7dbfe6994d
3795 changed files with 1363358 additions and 0 deletions
44
Engine/lib/opcode/Ice/IcePlane.cpp
Normal file
44
Engine/lib/opcode/Ice/IcePlane.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Contains code for planes.
|
||||
* \file IcePlane.cpp
|
||||
* \author Pierre Terdiman
|
||||
* \date April, 4, 2000
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Plane class.
|
||||
* \class Plane
|
||||
* \author Pierre Terdiman
|
||||
* \version 1.0
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include "../Opcode.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
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
Plane& Plane::Set(const Point& p0, const Point& p1, const Point& p2)
|
||||
{
|
||||
Point Edge0 = p1 - p0;
|
||||
Point Edge1 = p2 - p0;
|
||||
|
||||
n = Edge0 ^ Edge1;
|
||||
n.Normalize();
|
||||
|
||||
d = -(p0 | n);
|
||||
|
||||
return *this;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue