From 956abb4a265bb25dba0aea4de930e92962eedc44 Mon Sep 17 00:00:00 2001 From: Will Fowler Date: Tue, 10 Nov 2015 14:09:01 -0700 Subject: [PATCH] Normalizing Vector2d.zero returns Vector2d.zero. --- LibBSP/Source/Structs/Common/Vector2d.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LibBSP/Source/Structs/Common/Vector2d.cs b/LibBSP/Source/Structs/Common/Vector2d.cs index ebcc7c0..652793b 100644 --- a/LibBSP/Source/Structs/Common/Vector2d.cs +++ b/LibBSP/Source/Structs/Common/Vector2d.cs @@ -80,6 +80,7 @@ namespace LibBSP { /// public Vector2d normalized { get { + if (this == Vector2d.zero) { return Vector2d.zero; } double magnitude = this.magnitude; return new Vector2d(x / magnitude, y / magnitude); } @@ -356,6 +357,7 @@ namespace LibBSP { /// Changes this vector to its normalized version (it will have a magnitude of 1). /// public void Normalize() { + if (this == Vector2d.zero) { return; } double magnitude = this.magnitude; x /= magnitude; y /= magnitude;