Skip to content

Commit

Permalink
Compare squared distance against squared radius in Circle Contains po…
Browse files Browse the repository at this point in the history
…int method. (#1936)
  • Loading branch information
djoyahoy authored Feb 11, 2024
1 parent b64fecf commit 1aadefa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Maths/Silk.NET.Maths/Circle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public Circle(T centerX, T centerY, T radius)
/// <remarks>This does consider a point on the edge contained.</remarks>
public bool Contains(Vector2D<T> point)
{
return Scalar.LessThanOrEqual(Vector2D.DistanceSquared(point, Center), Radius);
return Scalar.LessThanOrEqual(Vector2D.DistanceSquared(point, Center), SquaredRadius);
}

/// <summary>
Expand Down Expand Up @@ -177,4 +177,4 @@ public Circle<TOther> As<TOther>() where TOther : unmanaged, IFormattable, IEqua
return new(Center.As<TOther>(), Scalar.As<T, TOther>(Radius));
}
}
}
}

0 comments on commit 1aadefa

Please sign in to comment.