Esempio n. 1
0
from pycat.core import Window, Point, Color
from math import sqrt

window = Window()

A = Point(600,300)
B = Point(800,300)

c = A.x - B.x
a = c/2
b = sqrt(c**2 - a**2)

C = Point((A.x + B.x)/2,A.y + b)

window.create_line(A.x, A.y, B.x, B.y, width = 1000, color = Color.CYAN)
window.create_line(B.x, B.y, C.x, C.y, width = 1000, color = Color.GREEN)
window.create_line(C.x, C.y, A.x, A.y, width = 1000, color = Color.ORANGE)


window.run()
Esempio n. 2
0
from os import pardir
from pycat.core import Window, Point
from math import sqrt

w = Window()

A = Point(400, 200)
B = Point(800, 200)

a = A.x
b = B.x
c = (a - b) / 2
d = B.x - A.x

C = Point((a + b) / 2, sqrt(d**2 - c**2) + A.y)

ab = w.create_line(A.x, A.y, B.x, B.y)
bc = w.create_line(B.x, B.y, C.x, C.y)
ca = w.create_line(C.x, C.y, A.x, A.y)

w.run()
Esempio n. 3
0
from pycat.core import Window, Point
from math import sqrt

w = Window()

point_a = Point(500, 200)
point_b = Point(300, 200)
c = abs(point_b.x - point_a.x)
a = c / 2
b = sqrt(c**2 - a**2)
point_c = (point_a + point_b) / 2
point_c.y += b
line_ab = w.create_line(point_a.x, point_a.y, point_b.x, point_b.y)
line_ac = w.create_line(point_a.x, point_a.y, point_c.x, point_c.y)
line_bc = w.create_line(point_c.x, point_c.y, point_b.x, point_b.y)

w.run()
Esempio n. 4
0
from pycat.base.color import Color
from pycat.core import Window, Point
from math import sqrt

w = Window()

point_a = Point(100, 200)
point_b = Point(300, 200)
c = abs(point_a.x - point_b.x)
a = c / 2
b = sqrt(c**2 - a**2)
point_c = (point_a + point_b) / 2
point_c.y += b

w.create_line(point_a.x, point_a.y, point_b.x, point_b.y, 3, Color.AMBER)
w.create_line(point_b.x, point_b.y, point_c.x, point_c.y, 3, Color.AZURE)
w.create_line(point_c.x, point_c.y, point_a.x, point_a.y, 3, Color.CHARTREUSE)

w.run()