I have series of land coordinate;
A = [[[18.12, 33.40],[31.24, 33.63], [31.25, 1.56], [18.125, 0.90],[18.12, 33.40]],
[[31.24, 33.63],[57.5, 34.08],[57.50, 17.82] [31.25, 17.82],[31.24, 33.63]],
[[57.50, 17.82], [31.25, 17.82], [31.25, 1.56],[57.5, 2.87],[57.50, 17.82]],
[[57.5, 34.08], [83.75, 34.54], [83.75, 18.70], [57.50, 18.70], [57.5, 34.08]],
[[83.75, 18.70], [57.50, 18.70], [57.5, 2.87], [83.75, 4.18], [83.75, 18.70]],
[[83.75, 34.54], [110.0, 35.0],[104.86, 19.59], [83.75, 19.59], [83.75, 34.54]],
[[104.86, 19.59], [83.75, 19.59], [83.75, 4.18], [100.0, 5.0], [104.86, 19.59]],
[[-5.0, 33.0], [18.12, 33.40], [18.125, 16.70], [-2.53, 16.70], [-5.0, 33.0]],
[[18.12, 16.70],[-2.53, 16.70],[0.0, 0.0], [18.125, 0.90], [18.12, 16.70]]]].
'A' forms 9 rectangles but for some reason plt.plot shows diagonal lines. Please consider the shape without the diagonal lines.
I also have series of codes creating different shapes of building using the coordinates of a rectangle. For example, if I have a rectangle coordinates of C, I will get following plotted results (second picture below) using create_L_bldg(C)
.
def create_L_bldg(C):
W = random.randint(45, 66)/100
x1, y1 = (1-W)*C[0,0] + C[3,0]*W, (1-W)*C[0,1] + C[3,1]*W
x2, y2 = (1-W)*C[0,0] + C[2,0]*W, (1-W)*C[0,1] + C[2,1]*W
x3, y3 = (1-W)*C[0,0] + C[1,0]*W, (1-W)*C[0,1] + C[1,1]*W
x4, y4 = C[1,0], C[1,1]
x5, y5 = C[2,0], C[2,1]
x6, y6 = A[3,0], A[3,1]
return x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6
If I also have create_U_bldg()
, create_sq_bldg()
along with create_L_bldg()
, then how can I randomly apply building shape codes in land coordinate 'A'?
Aucun commentaire:
Enregistrer un commentaire