import numpy as np
import cv2
import imutils

height_map = 250
width_map = 400
clr_robot = 5

map = np.zeros((height_map, width_map, 3), dtype='uint8')

for x in range(width_map):
    for y in range(height_map):
        # co-ordinates for 'map' are interchanged due to OpenCV convention
        
        # For the Convex circular region
        if ((x-300)**2 + (y-65)**2 <= ((40+clr_robot)**2)):
            map[y][x] = [255,255,255]
        
        # For the Convex hexagonal region
        if (y+(0.57*x)) >= 218.53 and (y-(0.57*x))>= -10.04 and (x<=240) and (y+(0.57*x))<=310.04 and (y-(0.57*x)) <= 81.465 and (x >= 160):
        # if (j+(0.57*i)-218.53)>=0 and (j-(0.57*i)+10.04)>=0 and (i-240)<=0 and (j+(0.57*i)-310.04)<=0 and (j-(0.57*i)-81.465)<=0 and (i-160)>=0:
            map[y][x] = [255,255,255]

        # For the Non-Convex triangular region
        if ((y+(0.316*x) >= 71.1483) and (y+(0.857*x) <= 145.156) and (y-(0.114*x) <= 60.909)) or ((y-(1.23*x)) <= 28.576 and (y-(3.2*x)) >= -202.763 and (y-(0.114*x)) >= 60.909):
            map[y][x] = [255,255,255]

        # For the outer boundaries (Non-Convex shape)
        if (x<=clr_robot) or (x>=(400-clr_robot)) or (y<=clr_robot) or (y>=(250-clr_robot)):
            map[y][x] = [255,255,255]    

# Resizing the map to 800x500 resolution for better visibilty
map = imutils.resize(map, height=2*height_map, width=2*width_map)

cv2.imshow("Map",map)
cv2.waitKey(0)
cv2.destroyAllWindows()