mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Use squared distance
This commit is contained in:
@ -78,10 +78,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
Vector2 dir = p2 - p1;
|
Vector2 dir = p2 - p1;
|
||||||
|
|
||||||
float projLength = MathHelper.Clamp(Vector2.Dot(position - p1, dir) / dir.LengthSquared, 0, 1);
|
float projLength = MathHelper.Clamp(Vector2.Dot(position - p1, dir) / dir.LengthSquared, 0, 1);
|
||||||
Vector2 proj = p1 + projLength * dir;
|
Vector2 proj = p1 + projLength * dir;
|
||||||
|
|
||||||
float dist = Vector2.Distance(position, proj);
|
float dist = Vector2.DistanceSquared(position, proj);
|
||||||
|
|
||||||
if (dist < minDistance)
|
if (dist < minDistance)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user