Truly fix length error (probably)
This commit is contained in:
7
main.py
7
main.py
@@ -306,13 +306,16 @@ random_points = [Point2D(random.randint(min_val, max_val), random.randint(
|
|||||||
# random_points = [Point2D(-40, -56), Point2D(-94, 92), Point2D(19, -47), Point2D(
|
# random_points = [Point2D(-40, -56), Point2D(-94, 92), Point2D(19, -47), Point2D(
|
||||||
# 100, 59), Point2D(-85, -73), Point2D(-33, -9), Point2D(57, -25), Point2D(51, -34)]
|
# 100, 59), Point2D(-85, -73), Point2D(-33, -9), Point2D(57, -25), Point2D(51, -34)]
|
||||||
|
|
||||||
random_points = random_points[0].optimized_path(random_points)
|
# random_points = random_points[0].optimized_path(random_points)
|
||||||
|
|
||||||
print(random_points)
|
# print(random_points)
|
||||||
|
|
||||||
# random_points = [Point2D(94, 71), Point2D(-12, 54), Point2D(-28, 10), Point2D(
|
# random_points = [Point2D(94, 71), Point2D(-12, 54), Point2D(-28, 10), Point2D(
|
||||||
# 0, -33), Point2D(80, -50), Point2D(73, -89), Point2D(-86, -3), Point2D(-82, 92)]
|
# 0, -33), Point2D(80, -50), Point2D(73, -89), Point2D(-86, -3), Point2D(-82, 92)]
|
||||||
|
|
||||||
|
random_points = [Point2D(-59, -21), Point2D(-43, -19), Point2D(-61, 19), Point2D(
|
||||||
|
45, 19), Point2D(80, -4), Point2D(99, 2), Point2D(47, 63), Point2D(100, -91)]
|
||||||
|
|
||||||
p = Polyline(random_points)
|
p = Polyline(random_points)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -61,11 +61,14 @@ class Polyline:
|
|||||||
self.get_arcs_intersections()
|
self.get_arcs_intersections()
|
||||||
self.get_arcs()
|
self.get_arcs()
|
||||||
self.get_segments()
|
self.get_segments()
|
||||||
|
print("\nlekj\n", self.segments, "\nklj\n")
|
||||||
|
|
||||||
self.total_line_output = []
|
self.total_line_output = []
|
||||||
for i in range(1, self.length_polyline-1):
|
for i in range(1, self.length_polyline-1):
|
||||||
self.total_line_output.extend(self.segments[i].segment())
|
self.total_line_output.extend(self.segments[i].segment())
|
||||||
self.total_line_output.extend(self.arcs[i])
|
self.total_line_output.extend(self.arcs[i])
|
||||||
|
self.total_line_output.extend(
|
||||||
|
self.segments[self.length_polyline-1].segment())
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return str(self.alpha_radii)
|
return str(self.alpha_radii)
|
||||||
@@ -137,7 +140,7 @@ class Polyline:
|
|||||||
|
|
||||||
# Why -3?
|
# Why -3?
|
||||||
# For n points, there are n-1 segments.
|
# For n points, there are n-1 segments.
|
||||||
self.segments[-3] = Segment2D(self.acrs_intersections[-2][2], Point2D.from_arrays(
|
self.segments[-1] = Segment2D(self.acrs_intersections[-2][2], Point2D.from_arrays(
|
||||||
self.points_array[-1]))
|
self.points_array[-1]))
|
||||||
|
|
||||||
return self.segments
|
return self.segments
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class Road:
|
|||||||
nearest_points_to_reference = []
|
nearest_points_to_reference = []
|
||||||
for i in range(len(self.coordinates)):
|
for i in range(len(self.coordinates)):
|
||||||
nearest_points_to_reference.append(Point3D.insert_3d([Point3D.to_2d([self.coordinates[i]], 'y')[0].nearest(
|
nearest_points_to_reference.append(Point3D.insert_3d([Point3D.to_2d([self.coordinates[i]], 'y')[0].nearest(
|
||||||
self.polyline.total_line_output)], 'y', [self.coordinates[i].y]))
|
self.polyline.total_line_output)], 'y', [self.coordinates[i].y])[0])
|
||||||
print(nearest_points_to_reference)
|
print(nearest_points_to_reference)
|
||||||
|
|
||||||
def place(self):
|
def place(self):
|
||||||
|
|||||||
BIN
output_image.png
BIN
output_image.png
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 2.6 KiB |
Reference in New Issue
Block a user