I am beginner with Compas and confused about the behaviour of the code, see below. I created a root regular triangle, and after that I wanted to add a regular square at one edge of the triangle with aligned vertices. Some points now have not the same coordinates, but they should have. Also the plotter is showing a gap between endpoints of polyline pl4 and polyline pl9, and also between pl8 and pl9. I want to add more regular polygons to the other edges of the triangle, i.e. a pentagon or a hexagon, and 2 of their vertices should be aligned with 2 of the triangle vertices. Do I miss something conceptually?
from compas.geometry import Point, Polyline, Rotation
from compas_plotters import Plotter
from numpy import math
xaxis, yaxis, zaxis = [1, 0, 0], [0, 1, 0], [0, 0, 1]
a = Point(0,0)
b = Point(1,0)
pl1 = Polyline([a,b])
R = Rotation.from_axis_and_angle(zaxis,math.radians(120))
pl2 = pl1.transformed(R)
R = Rotation.from_axis_and_angle(zaxis,math.radians(240))
pl3 = pl1.transformed(R)
plotter = Plotter()
plotter.add(pl1,draw_points=False)
plotter.add(pl2,draw_points=False)
plotter.add(pl3,draw_points=False)
pl4 = Polyline([[pl1[1].x,pl1[1].y],[pl2[1].x,pl2[1].y]])
pl5 = Polyline([[pl2[1].x,pl2[1].y],[pl3[1].x,pl3[1].y]])
pl6 = Polyline([[pl3[1].x,pl3[1].y],[pl1[1].x,pl1[1].y]])
plotter.add(pl4,draw_points=False)
plotter.add(pl5,draw_points=False)
plotter.add(pl6,draw_points=False)
R = Rotation.from_axis_and_angle([0,0,1],math.radians(270),[pl4[0].x,pl4[0].y,1])
pl7 = pl4.transformed(R)
R = Rotation.from_axis_and_angle([0,0,1],math.radians(270),[pl7[1].x,pl7[1].y,1])
pl8 = pl7.transformed(R)
R = Rotation.from_axis_and_angle([0,0,1],math.radians(270),[pl8[0].x,pl8[0].y,1])
pl9 = pl8.transformed(R)
plotter.add(pl7,draw_points=False)
plotter.add(pl8,draw_points=False)
plotter.add(pl9,draw_points=False)
plotter.show()
print(pl4)
Polyline([Point(1.000, 0.000, 0.000), Point(-0.500, 0.866, 0.000)])
print(pl9)
Polyline([Point(0.366, 2.366, 0.000), Point(-0.500, 0.866, 0.000)])
print(pl4[1].x,pl9[1].x)
-0.4999999999999998 -0.5
print(pl4[1].x==pl9[1].x)
False
print(pl8[0].x,pl9[0].x)
0.36602540378443976 0.3660254037844397
print(pl8[0].x==pl9[0].x)
False
print(pl8[1].x,pl7[1].x)
1.866025403784439 1.866025403784439
print(pl8[1].x==pl7[1].x)
True
print(pl4[0].x,pl7[0].x)
1.0 1.0
print(pl4[0].x==pl7[0].x)
True