Fix bug in ellipse/ellipsoid

This commit is contained in:
30hours 2024-03-14 03:40:06 +00:00
parent 129bf2fcc8
commit f737d5602d
3 changed files with 14 additions and 9 deletions

View file

@ -103,6 +103,9 @@ class EllipseParametric:
if valid_point: if valid_point:
samples_intersect.append(point1) samples_intersect.append(point1)
if len(samples_intersect) == 0:
continue
average_point = Geometry.average_points(samples_intersect) average_point = Geometry.average_points(samples_intersect)
samples_intersect = [average_point] samples_intersect = [average_point]
@ -132,7 +135,7 @@ class EllipseParametric:
if min_point1 is not None: if min_point1 is not None:
samples_intersect.append(min_point1) samples_intersect.append(min_point1)
else: else:
return output continue
else: else:
print('Invalid method.') print('Invalid method.')
@ -142,8 +145,6 @@ class EllipseParametric:
output[target] = {} output[target] = {}
output[target]["points"] = [] output[target]["points"] = []
for i in range(len(samples_intersect)): for i in range(len(samples_intersect)):
print('err??', flush=True)
print(samples_intersect, flush=True)
samples_intersect[i] = Geometry.ecef2lla( samples_intersect[i] = Geometry.ecef2lla(
samples_intersect[i][0], samples_intersect[i][0],
samples_intersect[i][1], samples_intersect[i][1],

View file

@ -100,12 +100,12 @@ class EllipsoidParametric:
if valid_point: if valid_point:
samples_intersect.append(point1) samples_intersect.append(point1)
if len(samples_intersect) == 0:
continue
average_point = Geometry.average_points(samples_intersect) average_point = Geometry.average_points(samples_intersect)
samples_intersect = [average_point] samples_intersect = [average_point]
if len(samples_intersect) == 0:
return output
elif self.method == "minimum": elif self.method == "minimum":
min_distance = self.threshold min_distance = self.threshold
@ -132,7 +132,7 @@ class EllipsoidParametric:
if min_point1 is not None: if min_point1 is not None:
samples_intersect.append(min_point1) samples_intersect.append(min_point1)
else: else:
return output continue
else: else:
print('Invalid method.') print('Invalid method.')
@ -141,6 +141,10 @@ class EllipsoidParametric:
# remove duplicates and convert to LLA # remove duplicates and convert to LLA
output[target] = {} output[target] = {}
output[target]["points"] = [] output[target]["points"] = []
print('test', flush=True)
print(samples_intersect, flush=True)
for i in range(len(samples_intersect)): for i in range(len(samples_intersect)):
samples_intersect[i] = Geometry.ecef2lla( samples_intersect[i] = Geometry.ecef2lla(
samples_intersect[i][0], samples_intersect[i][0],

View file

@ -99,8 +99,8 @@ def main():
method_localisation = method["localisation"] method_localisation = method["localisation"]
# override skip a method # override skip a method
if method_localisation == "spherical-intersection": #if method_localisation == "spherical-intersection":
continue #continue
if method_localisation not in position: if method_localisation not in position:
position[method_localisation] = {} position[method_localisation] = {}