Fix gaps when near collinear centers and arc intersections
This commit is contained in:
@@ -112,12 +112,18 @@ class Polyline:
|
|||||||
# Instead of two independant arc intersection, we make sure to combine both.
|
# Instead of two independant arc intersection, we make sure to combine both.
|
||||||
if i > 1:
|
if i > 1:
|
||||||
if point_1.distance(self.acrs_intersections[i-1][2]) <= 2:
|
if point_1.distance(self.acrs_intersections[i-1][2]) <= 2:
|
||||||
print(point_1, self.acrs_intersections[i-1][2])
|
|
||||||
middle = Segment2D(
|
middle = Segment2D(
|
||||||
|
self.centers[i], self.centers[i-1]).middle_point()
|
||||||
|
combined = Segment2D(
|
||||||
point_1, self.acrs_intersections[i-1][2]).middle_point()
|
point_1, self.acrs_intersections[i-1][2]).middle_point()
|
||||||
print(middle)
|
|
||||||
|
# To correct mis-alignement bewteen center 1 - arc intersection 1 and 2 combined - center 2
|
||||||
|
if middle.distance(combined) <= 2:
|
||||||
point_1 = middle
|
point_1 = middle
|
||||||
self.acrs_intersections[i-1][2] = middle
|
self.acrs_intersections[i-1][2] = middle
|
||||||
|
else:
|
||||||
|
point_1 = combined
|
||||||
|
self.acrs_intersections[i-1][2] = combined
|
||||||
|
|
||||||
self.acrs_intersections[i] = [point_1.round(), Point2D.from_arrays(
|
self.acrs_intersections[i] = [point_1.round(), Point2D.from_arrays(
|
||||||
self.points_array[i]), point_2.round()]
|
self.points_array[i]), point_2.round()]
|
||||||
|
|||||||
@@ -112,10 +112,10 @@ class Road:
|
|||||||
editor.placeBlock(Point3D.insert_3d(
|
editor.placeBlock(Point3D.insert_3d(
|
||||||
[self.polyline.acrs_intersections[i][2]], 'y', [230])[0].coordinates, Block("pink_concrete"))
|
[self.polyline.acrs_intersections[i][2]], 'y', [230])[0].coordinates, Block("pink_concrete"))
|
||||||
|
|
||||||
geometry.placeLine(editor, Point3D.insert_3d([double_point_a], 'y', [250])[
|
geometry.placeLine(editor, Point3D.insert_3d([double_point_a], 'y', [229])[
|
||||||
0].coordinates, Point3D.insert_3d([self.polyline.centers[i]], 'y', [250])[0].coordinates, Block("blue_concrete"))
|
0].coordinates, Point3D.insert_3d([self.polyline.centers[i]], 'y', [229])[0].coordinates, Block("blue_concrete"))
|
||||||
geometry.placeLine(editor, Point3D.insert_3d([double_point_b], 'y', [250])[
|
geometry.placeLine(editor, Point3D.insert_3d([double_point_b], 'y', [229])[
|
||||||
0].coordinates, Point3D.insert_3d([self.polyline.centers[i]], 'y', [250])[0].coordinates, Block("red_concrete"))
|
0].coordinates, Point3D.insert_3d([self.polyline.centers[i]], 'y', [229])[0].coordinates, Block("red_concrete"))
|
||||||
|
|
||||||
for j in range(len(circle)):
|
for j in range(len(circle)):
|
||||||
for k in range(len(circle[j])):
|
for k in range(len(circle[j])):
|
||||||
|
|||||||
Reference in New Issue
Block a user