Closed radi2015 closed 2 years ago
line0 := space.LineString{{116.40495300292967, 39.926785883895654}, {116.3975715637207, 39.9295502919}} line1 := space.LineString{{116.37310981750488, 39.92099342895789}, {116.39928817749023, 39.9174387253541}} fmt.Println(line1.Distance(line0)) 0 <nil>
dist is initialized with 0, this for impossible in if distP, _ := elem.Distance(); dist > distP { dist = distP }
var dist float64 modified with var dist float64 = math.MaxFloat64
修改问题源码 func (el *ElementDistance) distanceLineAndLine() (float64, error) { var dist float64 if mark := relate.IsIntersectionEdge(el.From.(matrix.LineMatrix), el.To.(matrix.LineMatrix)); mark { return 0, nil } for _, v := range el.From.(matrix.LineMatrix) { elem := &ElementDistance{matrix.Matrix(v), el.To, el.F} if distP, _ := elem.Distance(); dist > distP { dist = distP } } return dist, nil }
thanks,we will fix it recently
we have fix it ,you can use the latest code in branch main, and we will release new version recently
dist is initialized with 0, this for impossible in if distP, _ := elem.Distance(); dist > distP { dist = distP }
var dist float64 modified with var dist float64 = math.MaxFloat64