Point and Vector Length/LengthSquared

This commit is contained in:
Matt Thorson 2020-05-30 21:02:26 -07:00
parent 228295649e
commit 53ab0a7910
2 changed files with 5 additions and 17 deletions

View File

@ -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 [ ");

View File

@ -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()