From 79cacbf36e585496873ae43705a911280e3ff42a Mon Sep 17 00:00:00 2001 From: Wojciech Figat Date: Mon, 14 Feb 2022 10:15:05 +0100 Subject: [PATCH] Add GetNormal to Triangle --- Source/Engine/Core/Math/Triangle.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/Engine/Core/Math/Triangle.h b/Source/Engine/Core/Math/Triangle.h index 72aee5409..a830f7e3e 100644 --- a/Source/Engine/Core/Math/Triangle.h +++ b/Source/Engine/Core/Math/Triangle.h @@ -49,6 +49,13 @@ public: { } +public: + + Vector3 GetNormal() const + { + return Vector3::Normalize((V1 - V0) ^ (V2 - V0)); + } + public: // Determines if there is an intersection between the current object and a Ray