float32 -> float64
This commit is contained in:
+5
-5
@@ -51,7 +51,7 @@ func RectIntersection(r AABB2d, p Point2d, v Vector2d) (bool, bool, *Point2d) {
|
||||
}
|
||||
}
|
||||
|
||||
func ProjectPolygon(axis Vector2d, p Polygon2d) (min float32, max float32) {
|
||||
func ProjectPolygon(axis Vector2d, p Polygon2d) (min float64, max float64) {
|
||||
min = axis.Dot(p.Origin.Add(p.Points[0]).ToVector())
|
||||
max = min
|
||||
for _, point := range p.Points {
|
||||
@@ -72,7 +72,7 @@ func PolygonIntersection(r Polygon2d, p Point2d, v Vector2d) (bool, *Point2d) {
|
||||
// inside situations
|
||||
intersection := false
|
||||
var iPoint *Point2d
|
||||
distance_sq := float32(math.MaxFloat32)
|
||||
distance_sq := math.MaxFloat64
|
||||
|
||||
for point, _ := range r.Points {
|
||||
edgePt, edgeVec := r.Edge(point)
|
||||
@@ -95,7 +95,7 @@ func PointInPolygon(p Point2d, py Polygon2d) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func IntervalDistance(p1min, p1max, p2min, p2max float32) float32 {
|
||||
func IntervalDistance(p1min, p1max, p2min, p2max float64) float64 {
|
||||
if p1min < p2min {
|
||||
return p2min - p1max
|
||||
} else {
|
||||
@@ -110,7 +110,7 @@ func PolyPolyIntersection(p1 Polygon2d, v1 Vector2d, p2 Polygon2d) (bool, bool,
|
||||
will_intersect := true
|
||||
translation := Vector2d{}
|
||||
edges := []Vector2d{}
|
||||
minimum_interval_distance := float32(math.MaxFloat32)
|
||||
minimum_interval_distance := math.MaxFloat64
|
||||
|
||||
for point, _ := range p1.Points {
|
||||
_, edgeVec := p1.Edge(point)
|
||||
@@ -151,7 +151,7 @@ func PolyPolyIntersection(p1 Polygon2d, v1 Vector2d, p2 Polygon2d) (bool, bool,
|
||||
break
|
||||
}
|
||||
|
||||
interval_distance := float32(math.Abs(float64(dist)))
|
||||
interval_distance := math.Abs(dist)
|
||||
if interval_distance < minimum_interval_distance {
|
||||
minimum_interval_distance = interval_distance
|
||||
translation = axis
|
||||
|
||||
Reference in New Issue
Block a user