diff --git a/utils/geometry/circle.go b/utils/geometry/circle.go index b6b1709..8da0aa8 100644 --- a/utils/geometry/circle.go +++ b/utils/geometry/circle.go @@ -13,7 +13,6 @@ func GenerateCircle[V generic.SignedNumber](radius V, points int) Shape[V] { curAngle := float64(i) * angle x := radius * V(math.Cos(curAngle)) y := radius * V(math.Sin(curAngle)) - shape = append(shape, NewPoint(x, y)) } return shape diff --git a/utils/geometry/circle_test.go b/utils/geometry/circle_test.go new file mode 100644 index 0000000..580c767 --- /dev/null +++ b/utils/geometry/circle_test.go @@ -0,0 +1,11 @@ +package geometry_test + +import ( + "fmt" + "github.com/kercylan98/minotaur/utils/geometry" + "testing" +) + +func TestGenerateCircle(t *testing.T) { + fmt.Println(geometry.GenerateCircle[float64](5, 12)) +} diff --git a/utils/geometry/shape.go b/utils/geometry/shape.go index 6af79aa..ef5a051 100644 --- a/utils/geometry/shape.go +++ b/utils/geometry/shape.go @@ -30,7 +30,7 @@ func (slf Shape[V]) String() string { for x := left; x < left+width; x++ { exist := false for _, p := range slf { - if x == p.GetX() && y == p.GetY() { + if int(x) == int(p.GetX()) && int(y) == int(p.GetY()) { exist = true break }