mirror of
https://github.com/MaddyThorson/StrawberryBF.git
synced 2025-02-18 11:38:28 +08:00
Point and Vector Length/LengthSquared
This commit is contained in:
parent
228295649e
commit
53ab0a7910
@ -38,6 +38,9 @@ namespace Strawberry
|
|||||||
return .(-Y, X);
|
return .(-Y, X);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float Length => Math.Sqrt(LengthSquared);
|
||||||
|
public int LengthSquared => X * X + Y * Y;
|
||||||
|
|
||||||
public override void ToString(String strBuffer)
|
public override void ToString(String strBuffer)
|
||||||
{
|
{
|
||||||
strBuffer.Set("Point [ ");
|
strBuffer.Set("Point [ ");
|
||||||
|
@ -32,23 +32,8 @@ namespace Strawberry
|
|||||||
return .(-Y, X);
|
return .(-Y, X);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float Length
|
public float Length => Math.Sqrt(LengthSquared);
|
||||||
{
|
public float LengthSquared => X * X + Y * Y;
|
||||||
[Inline]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Math.Sqrt(LengthSquared);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public float LengthSquared
|
|
||||||
{
|
|
||||||
[Inline]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return X * X + Y * Y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Inline]
|
[Inline]
|
||||||
public Point Round()
|
public Point Round()
|
||||||
|
Loading…
Reference in New Issue
Block a user