import pygame, sys, math from pygame.locals import * from euclidMath import Math pygame.init() screen = pygame.display.set_mode((900, 900)) Math = Math() #variables a = (450, 240) b = (350, 420) c = (a[0] - b[0] + a[0], b[1]) distAB = Math.distance(a[0], a[1], b[0], b[1]) distBC = Math.distance(c[0], c[1], b[0], b[1]) f = (int((b[0] - a[0]) * 1.5 + b[0]), int((b[1] - a[1]) * 1.5 + b[1])) g = (int((c[0] - a[0]) * 1.5 + c[0]), int((c[1] - a[1]) * 1.5 + c[1])) distAF = Math.distance(a[0], a[1], f[0], f[1]) #white screen screen.fill((255, 255, 255)) # Let ABC be an isosceles triangle having the side AB equal to the side AC; pygame.draw.line(screen, (0, 0, 0), a, b, 2) pygame.draw.line(screen, (0, 0, 0), b, c, 2) pygame.draw.line(screen, (0, 0, 0), c, a, 2) # and let the straight lines BD, CE be produced further in a straight line with AB, AC
import pygame, sys, math from pygame.locals import * from euclidMath import Math pygame.init() Math = Math() screen = pygame.display.set_mode((600, 600)) screen.fill((255, 255, 255)) # To find the center* of a cricle a = (250, 350) b = (350, 350) c = (300, 300) distCB = Math.distance(a[0], c[0], a[1], c[1]) pygame.draw.line(screen, (0, 0, 0), a, b, 2) pygame.draw.line(screen, (0, 0, 0), (300, 600), (300, 0), 2) pygame.draw.circle(screen, (0, 0, 0), c, distCB, 2) pygame.display.flip() while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit()
pygame.init() screen = pygame.display.set_mode((600, 600)) Math = Math() # To draw a straight line at right angles to a given sdtraight line from a given point on it. a = (0, 400) b = (600, 400) c = (300, 400) d = (100, 400) e = (500, 400) dist = Math.distance(d[0], d[1], e[0], e[1]) f = (Math.avg(d[0], e[0]), d[1] - Math.pythagac(dist / 2, dist)) # Fill the screen with white. screen.fill((255, 255, 255)) # Let AB be the given straight line, and C the given point on it. pygame.draw.line(screen, (0, 0, 0), a, b, 2) # Let a point D be taken at random on AC; let Ce be made equal to CD; on DE let the equilater triangle FDE be constructed, and let FC be joined. pygame.draw.circle(screen, (0, 0, 0), c, Math.distance(d[0], 0, c[0], 0), 1)
import pygame, sys, math from pygame.locals import * from euclidMath import Math pygame.init() screen = pygame.display.set_mode((800, 800)) Math = Math() # To place at a given point a straight line euqal to a given straight line. a = (300, 420) b = (420, 420) c = (269, 242) distAB = Math.distance(a[0], a[1], b[0], b[1]) distBC = Math.distance(c[0], c[1], b[0], b[1]) d = (Math.avg(a[0], b[0]), a[1] - Math.pythagac(distAB / 2, distAB)) distDB = Math.distance(d[0], d[1], b[0], b[1]) # Fill screen with white. screen.fill((255, 255, 255)) # Let A be the given point, and BC the given straight line. pygame.draw.circle(screen, (0, 0, 0), a, 2) pygame.draw.line(screen, (0, 0, 0), b, c, 2) # Thus it is required to place at the point A a straight line equal to the given straight line BC. # From the point A to the point B let the straight line AB be joined; and on it let the equilateral triangle DAB be constructed.
#To a given infinite straight line, from a given point which is not on it, to draw a perpendicular straight line. #make it so the screen isn't a void screen.fill((255, 255, 255)) #"Infinate line" pygame.draw.line(screen, (0, 0, 0), (-1, 400), (601, 400), 2) #key points d = (453, 563) c = (300, 350) distCD = Math.distance(d[0], d[1], c[0], c[1]) h = (c[0], 400) distCH = h[1] - c[1] distCE = Math.pythagac(distCH, distCD) e = (c[0] + distCE, 400) g = (c[0] - distCE, 400) #circle, and perpendicular line pygame.draw.circle(screen, (0, 0, 0), c, distCD, 2) pygame.draw.line(screen, (0, 0, 0), c, (c[0], 400), 2) #lines going from C to the point where the circle touches the the line pygame.draw.line(screen, (0, 0, 0), c, e, 2)
Math = Math() screen = pygame.display.set_mode((600, 600)) screen.fill((255, 255, 255)) # A small rectangle equals a square a = (200, 200) b = (300, 200) c = (200, 300) d = (300, 300) e = (200, 250) distEB = Math.distance(e[0], e[1], b[0], b[1]) f = (200, 250 - distEB) g = (200 + distEB, 250 - distEB) h = (200 + distEB, 300) pygame.draw.line(screen, (0, 0, 0), a, b, 2) pygame.draw.line(screen, (0, 0, 0), c, b, 2) pygame.draw.line(screen, (0, 0, 0), c, d, 2) pygame.draw.line(screen, (0, 0, 0), a, d, 2) pygame.draw.line(screen, (0, 0, 0), e, b, 2) pygame.draw.line(screen, (0, 0, 0), a, f, 2) pygame.draw.line(screen, (0, 0, 0), f, g, 2) pygame.draw.line(screen, (0, 0, 0), g, h, 2)
import pygame, sys from pygame.locals import * from euclidMath import Math pygame.init() screen = pygame.display.set_mode((600, 600)) Math = Math() # On a given finite straight line to construct an equilateral triangle. a = (200, 400) b = (400, 400) dist = Math.distance(a[0], a[1], b[0], b[1]) # Fill screen with white screen.fill((255, 255, 255)) # Let AB be the given finite straight line. pygame.draw.line(screen, (0, 0, 0), a, b, 2) # With centre A and sistance AB let the circle BCD be described. pygame.draw.circle(screen, (0, 0, 0), a, dist, 1) # With center B and distance BA let the circle ACE be described. pygame.draw.circle(screen, (0, 0, 0), b, dist, 1) # From the point C, in which the circles cut one another, to the points A, B let the straight lines CA, CB be joined. pygame.draw.line(screen, (0, 0, 0), a, (Math.avg(a[0], b[0]), a[1] - Math.pythagac(dist/2, dist)), 2) pygame.draw.line(screen, (0, 0, 0), b, (Math.avg(a[0], b[0]), a[1] - Math.pythagac(dist/2, dist)), 2)
from euclidMath import Math pygame.init() screen = pygame.display.set_mode((800, 800)) Math = Math() # Given two unequal straight lines, to cut off from the greater a straigh line equal to the less. a = (350, 420) b = (690, 420) c = (10, 20) C = (200, 20) distcC = Math.distance(c[0], c[1], C[0], C[1]) # Fill screen with white. screen.fill((255, 255, 255)) # Let AB, C be the two given unequal straight lines, and let AB be the greater of them. pygame.draw.line(screen, (0, 0, 0), a, b, 2) pygame.draw.line(screen, (0, 0, 0), c, C, 2) # At the point A let AD be placed equal to the straight line C. pygame.draw.line(screen, (0, 0, 0), a, (a[0], a[1] - distcC), 2) # With the centre A and distance AD let the circle DEF be described.
from pygame.locals import * from euclidMath import Math pygame.init() screen = pygame.display.set_mode((1000 ,1000)) Math = Math() # To bisect a given rectilineal angle a = (400, 200) b = (678, 449) c = (a[0]-b[0]+a[0], 449) distBC = Math.distance(c[0], c[1], b[0], b[1]) sqrtisgay = Math.pythagac(distBC/2, distBC) d = (a[0], sqrtisgay + b[1]) # screen fill screen.fill((255, 255, 255)) # Triangle cunstruction pygame.draw.line(screen, (0, 0, 0), a, b, 2) pygame.draw.line(screen, (0, 0, 0), c, b, 2) pygame.draw.line(screen, (0, 0, 0), a, c, 2) # prop 2 on line bc