www.pudn.com > Gimcrack-v0.0051-Source.zip > triangle.cpp
#include "triangle.h"
// TODO: Store points and normal + cached public ones
GcTriangle::GcTriangle()
{
}
GcTriangle::GcTriangle( triType tA, triType tB, triType tC ) : a(tA), b(tB), c(tC)
{
}
GcVector3 GcTriangle::Normal() const
{
// Get 2 vectors from the triangle
GcVector3 Vector1 = c - a;
GcVector3 Vector2 = b - a;
// Use the cross product of our 2 vectors to calculate the normal
GcVector3 Normal = Vector1.CrossProduct(Vector2);
// Normalize the normal
Normal.Normalize();
return Normal;
}