float32 -> float64
This commit is contained in:
+7
-7
@@ -13,7 +13,7 @@ type Obstacle struct {
|
||||
Hp int `json:"-"`
|
||||
}
|
||||
|
||||
func (o Obstacle) distance_from_point(p v.Point2d) float32 {
|
||||
func (o Obstacle) distance_from_point(p v.Point2d) float64 {
|
||||
dist := math.MaxFloat32
|
||||
|
||||
dist = math.Min(dist, float64(p.Sub(o.Bounds.A).Mag()))
|
||||
@@ -21,7 +21,7 @@ func (o Obstacle) distance_from_point(p v.Point2d) float32 {
|
||||
dist = math.Min(dist, float64(p.Sub(v.Point2d{X: o.Bounds.A.X, Y: o.Bounds.B.Y}).Mag()))
|
||||
dist = math.Min(dist, float64(p.Sub(v.Point2d{X: o.Bounds.B.X, Y: o.Bounds.A.Y}).Mag()))
|
||||
|
||||
return float32(dist)
|
||||
return dist
|
||||
}
|
||||
|
||||
func (o Obstacle) minify() [4]int {
|
||||
@@ -41,13 +41,13 @@ func MinifyObstacles(o []Obstacle) [][4]int {
|
||||
|
||||
// GenerateObstacles returns a slice of (count) obstacles within a region
|
||||
// bounded by width, height.
|
||||
func GenerateObstacles(count int, width, height float32) []Obstacle {
|
||||
func GenerateObstacles(count int, width, height float64) []Obstacle {
|
||||
out := []Obstacle{}
|
||||
for i := 0; i < count; i++ {
|
||||
x := rand.Float32() * (width - (width / 10))
|
||||
y := rand.Float32() * (height - (height / 10))
|
||||
w := rand.Float32() * (width / 10)
|
||||
h := rand.Float32() * (height / 10)
|
||||
x := rand.Float64() * (width - (width / 10))
|
||||
y := rand.Float64() * (height - (height / 10))
|
||||
w := rand.Float64() * (width / 10)
|
||||
h := rand.Float64() * (height / 10)
|
||||
out = append(
|
||||
out,
|
||||
Obstacle{
|
||||
|
||||
Reference in New Issue
Block a user