mirror of
https://github.com/duke-git/lancet.git
synced 2026-11-16 05:12:11 +08:00
fix(mathutil): preserve distances at extreme scales (#360)
This commit is contained in:
1 parent
ec11fdf345
commit
9b0a0caa75
2 files changed
+10
-5
No files matched your search
@@ -299,11 +299,7 @@ func RadianToAngle(radian float64) float64 {
|
||||
// PointDistance get two points distance.
|
||||
// Play: https://go.dev/play/p/RrG4JIaziM8
|
||||
func PointDistance(x1, y1, x2, y2 float64) float64 {
|
||||
a := x1 - x2
|
||||
b := y1 - y2
|
||||
c := math.Pow(a, 2) + math.Pow(b, 2)
|
||||
|
||||
return math.Sqrt(c)
|
||||
return math.Hypot(x1-x2, y1-y2)
|
||||
}
|
||||
|
||||
// IsPrime checks if number is prime number.
|
||||
|
||||
Reference in new issue
Block a user