Does anyone know how i can connect each corner of the squares with polyline that create a cross (like the draw exemple)? My goal is to make those polyline follow the position of some corner if they are updated.
index every square by its (i,j) variable
– i is from left to right
– j is from top to bottom
order the points of the squares
– 0 is left bottom
– 1 is right bottom
– 2 is right top
– 3 is left top
get the neighbors
– the square (i,j) has 4 potential neighbors
— (i-1,j-1) is the left bottom
— (i+1,j-1) is the right bottom
— (i+1,j+1) is the right top
— (i-1,j+1) is the left top
grab the vertices and connect them
– v0 of (i,j) with v2 of (i-1,j-1)
– v1 of (i,j) with v3 of (i+1,j-1)
– v2 of (i,j) with v0 of (i+1,j+1)
– v3 of (i,j) with v1 of (i-1,j+1)
(check the indices, there may be some errors, but in principle this would be the way)
branching them in Lists sorted by columns would help very much, and you can get how many rectangles you have for each column from here in your definition:
Line A you can think about “from current rectangle take corner 3, and connect with rectangle one column to the right and one rectangle up, at corner 1”
Line B you can think about “from current rectangle take corner 2, and connect with rectangle one column to the right and one rectangle down, at corner 0”