Ejemplo n.º 1
0
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()
Ejemplo n.º 2
0
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))

# Parts of a whole add up

a = (200, 400)
b = (400, 400)
c = (200, 350)

d = (300, 400)

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)

pygame.draw.line(screen, (0, 0, 0), d, c, 2)

pygame.display.flip()

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT: sys.exit()
Ejemplo n.º 3
0
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.
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
import pygame, sys
from pygame.locals import *
from euclidMath import Math
pygame.init()

screen = pygame.display.set_mode((600, 600))

Math = Math()

#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)
Ejemplo n.º 6
0
import pygame, sys
from pygame.locals import *
from euclidMath import Math

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.
Ejemplo n.º 7
0
import sys, pygame
from pygame.locals import *
from euclidMath import Math
pygame.init()

Math = Math()

screen = pygame.display.set_mode((900, 600))

screen.fill((0, 0, 0))

#out of three straight lines, which are equal to three given straight lines, to construct a triangle: thus it is necessary that two of the straight lines taken together in any manner
#should be greater than the remaining one

lA = 100
lB = 200
#lC = 10, just KIDDING N***A, F**K YOU, l stands for length

a = (400, 200)
b = (200, 300)
c = (400, 300)
#c doesn't exist, it's just a place holder bc there's no fucktion for meeting at 90 degree angle
lC = Math.pythag(a, b)

eA = (600, 250)
eB = (600, 300)
eC = (600, 350)
fA = (600 + lA, 250)
fB = (600 + lB, 300)
fC = (600 + lC, 350)
Ejemplo n.º 8
0
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))

# 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)
Ejemplo n.º 9
0
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)
Ejemplo n.º 10
0
import pygame, sys, math
from pygame.locals import *
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)
Ejemplo n.º 11
0
import pygame, sys
from pygame.locals import *
from euclidMath import Math
pygame.init()

screen = pygame.display.set_mode((600, 600))

screen.fill((255, 255, 255))

Math = Math()

#On a given straight line and at a point on it to construct a rectilineal ange equal to a given rectilineal angle

a = (100, 400)
b = (500, 400)
c = (200, 250)
d = (349, 163)
e = (369, 250)

distCE = Math.vardist(c, e)

distDE = int(Math.vardist(e, d) / 3.43)

f = (a[0] + distCE, a[1])
g = (a[0] + distCE, a[1] - distDE)

pygame.draw.line(screen, (0, 0, 0), a, b, 2)
pygame.draw.line(screen, (0, 0, 0), d, c, 2)
pygame.draw.line(screen, (0, 0, 0), d, e, 2)
pygame.draw.line(screen, (0, 0, 0), e, c, 2)
pygame.draw.line(screen, (0, 0, 0), a, g, 2)
Ejemplo n.º 12
0
import sys, pygame, math
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)
Ejemplo n.º 13
0
import sys, pygame
from pygame.locals import *
from euclidMath import Math
pygame.init()

Math = Math()

screen = pygame.display.set_mode((600, 600))

screen.fill((255, 255, 255))

#In any triangle the gerater side subtends the greater angle.

a = (245, 130)
b = (245, 432)
c = (434, 259)
distBC = Math.vardist(b, c)
d = (a[0], b[1] - distBC)

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)
pygame.draw.line(screen, (0, 0, 0), c, d, 2)

pygame.draw.circle(screen, (0, 0, 0), b, distBC, 1)

pygame.display.flip()
input()