feat: add PointDistance

This commit is contained in:
dudaodong committed 2023-03-23 17:49:07 +08:00
1 parent c28803b25e
commit cde5946bf0
3 files changed
+27

No files matched your search

+10
View File
@@ -230,3 +230,13 @@ func RadianToAngle(radian float64) float64 {
angle := radian * (180 / math.Pi)
return angle
}
// PointDistance get two points distance.
// Play: todo
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)
}