From 53ab0a7910b7086977e5f8e9cb3695ec6929407a Mon Sep 17 00:00:00 2001 From: Matt Thorson Date: Sat, 30 May 2020 21:02:26 -0700 Subject: [PATCH] Point and Vector Length/LengthSquared --- src/Struct/Point.bf | 3 +++ src/Struct/Vector.bf | 19 ++----------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/Struct/Point.bf b/src/Struct/Point.bf index ad70ac5..3c90094 100644 --- a/src/Struct/Point.bf +++ b/src/Struct/Point.bf @@ -38,6 +38,9 @@ namespace Strawberry return .(-Y, X); } + public float Length => Math.Sqrt(LengthSquared); + public int LengthSquared => X * X + Y * Y; + public override void ToString(String strBuffer) { strBuffer.Set("Point [ "); diff --git a/src/Struct/Vector.bf b/src/Struct/Vector.bf index c8dd245..43de4b5 100644 --- a/src/Struct/Vector.bf +++ b/src/Struct/Vector.bf @@ -32,23 +32,8 @@ namespace Strawberry return .(-Y, X); } - public float Length - { - [Inline] - get - { - return Math.Sqrt(LengthSquared); - } - } - - public float LengthSquared - { - [Inline] - get - { - return X * X + Y * Y; - } - } + public float Length => Math.Sqrt(LengthSquared); + public float LengthSquared => X * X + Y * Y; [Inline] public Point Round()