-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraw.py
More file actions
35 lines (26 loc) · 766 Bytes
/
Copy pathdraw.py
File metadata and controls
35 lines (26 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pygame
WIDTH = 800
HEIGHT = 600
# Colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
GRAY = (128, 128, 128)
def initialise_map():
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("RRT Pathfinding")
clock = pygame.time.Clock()
return [screen, clock]
def screen_fill(screen):
screen.fill(BLACK)
def draw_circle(screen, obs, OBSTACLE_RADIUS, color = GRAY):
pygame.draw.circle(screen, color, obs, OBSTACLE_RADIUS)
def draw_line(screen, nearest_point, new_node, color = BLUE):
pygame.draw.line(screen, color, nearest_point, new_node, 1)
def flip_display():
pygame.display.flip()
def clock_tick(clock):
clock.tick(30)