mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:12:56 +08:00
Use squared distance
This commit is contained in:
parent
13b11996e0
commit
316dcae614
@ -78,10 +78,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
continue;
|
||||
|
||||
Vector2 dir = p2 - p1;
|
||||
|
||||
float projLength = MathHelper.Clamp(Vector2.Dot(position - p1, dir) / dir.LengthSquared, 0, 1);
|
||||
Vector2 proj = p1 + projLength * dir;
|
||||
|
||||
float dist = Vector2.Distance(position, proj);
|
||||
float dist = Vector2.DistanceSquared(position, proj);
|
||||
|
||||
if (dist < minDistance)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user