From b3873be514e51fd42706096f5d5fba0ed4e3b602 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 13 Dec 2021 18:09:26 +0100 Subject: [PATCH] - added some utilities to the Plane class that will be needed soon. --- source/common/utility/vectors.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/common/utility/vectors.h b/source/common/utility/vectors.h index 2118a22fa..1e5fa9f3a 100644 --- a/source/common/utility/vectors.h +++ b/source/common/utility/vectors.h @@ -1651,6 +1651,12 @@ public: m_d = d; } + void Init(const FVector3& p1, const FVector3& p2, const FVector3& p3) + { + m_normal = ((p2 - p1) ^ (p3 - p1)).Unit(); + m_d = -(p3 |m_normal); + } + // same for a play-vector. Note that y and z are inversed. void Set(DVector3 normal, double d) { @@ -1671,7 +1677,7 @@ public: return DistToPoint(x, y, z) < 0.f; } - bool PointOnSide(FVector3 &v) { return PointOnSide(v.X, v.Y, v.Z); } + bool PointOnSide(const FVector3 &v) { return PointOnSide(v.X, v.Y, v.Z); } float A() { return m_normal.X; } float B() { return m_normal.Y; } @@ -1684,4 +1690,5 @@ protected: float m_d; }; + #endif