# Points in an ellipse
import pygame
import math
pygame.init()
size = width, height = 600, 300
screen = pygame.display.set_mode((width, height))
xRadius = 250
yRadius = 100
for degree in range(360,0,-15):
x = int((math.cos(degree * 2 * math.pi / 360) * xRadius) + width/2)
y = int((math.sin(degree * 2 * math.pi / 360) * yRadius) + height/2)
# Prints the x and y coordinates of points in ellipse
print(x,y)
pygame.draw.circle(screen, (0, 125, 255), [x, y], 15)
pygame.display.flip()
OUTPUT:
import pygame
import math
pygame.init()
size = width, height = 600, 300
screen = pygame.display.set_mode((width, height))
xRadius = 250
yRadius = 100
for degree in range(360,0,-15):
x = int((math.cos(degree * 2 * math.pi / 360) * xRadius) + width/2)
y = int((math.sin(degree * 2 * math.pi / 360) * yRadius) + height/2)
# Prints the x and y coordinates of points in ellipse
print(x,y)
pygame.draw.circle(screen, (0, 125, 255), [x, y], 15)
pygame.display.flip()
OUTPUT:
550 149
541 124
516 99
476 79
425 63
364 53
299 50
235 53
174 63
123 79
83 99
58 124
50 150
58 175
83 200
123 220
175 236
235 246
300 250
364 246
425 236
476 220
516 200
541 175
No comments:
Post a Comment
Don't be a silent reader...
Leave your comments...
Anu