Python Turtle Graphics Drawing - AMD Logo
Source code:
from turtle import *
from math import atan2,degrees
def cbezto(b,c,d):
a=pos()
t = 0.0
while t <= 1.0:
t3 = t**3
t2 = t**2
f1 = -t3+3*t2-3*t+1
f2 = 3*t3-6*t2+3*t
f3 = -3*t3+3*t2
f4 = t3
x = a[0]*f1 + b[0]*f2 + c[0]*f3 + d[0]*f4
y = a[1]*f1 + b[1]*f2 + c[1]*f3 + d[1]*f4
d1 = -3*t2+6*t-3
d2 = 9*t2-12*t+3
d3 = -9*t2+6*t
d4 = 3*t2
dx = a[0]*d1 + b[0]*d2 + c[0]*d3 + d[0]*d4
dy = a[1]*d1 + b[1]*d2 + c[1]*d3 + d[1]*d4
angr = atan2(dy, dx)
seth(degrees(angr))
goto(x, y)
t += 0.05
goto(d)
up()
lt(121.9)
fd(431.2)
down()
begin_fill()
rt(121.9)
fd(446)
rt(90)
fd(445)
rt(135.2)
fd(174.7)
rt(44.8)
fd(199)
lt(90)
fd(200)
rt(44.8)
fd(173.2)
end_fill()
up()
lt(175.5)
fd(190)
down()
begin_fill()
rt(40.7)
fd(181)
lt(90)
fd(180)
rt(135)
fd(175.4)
rt(45)
fd(182)
rt(90)
fd(179)
rt(45)
fd(178.2)
end_fill()
up()
rt(155.7)
fd(620.9)
down()
begin_fill()
lt(178.5)
fd(198.7)
rt(67.8)
fd(52)
rt(66)
fd(201.4)
rt(114)
fd(49)
rt(66.6)
fd(40.3)
lt(66.6)
fd(82)
lt(70.6)
fd(39.2)
rt(70.6)
fd(49)
end_fill()
up()
lt(180)
fd(230)
down()
begin_fill()
lt(90)
fd(184)
rt(90)
fd(41)
rt(49.5)
fd(90.8)
lt(98.9)
fd(90.8)
rt(49.5)
fd(39)
rt(90)
fd(184)
rt(90)
fd(45)
rt(90)
fd(116)
lt(139.7)
fd(77.3)
rt(49.7)
fd(7)
rt(49.7)
fd(77.3)
lt(139.7)
fd(116)
rt(90)
fd(46)
end_fill()
up()
lt(218.2)
fd(297.7)
down()
begin_fill()
rt(38.2)
fd(79)
cbezto((274,-175),(294,-196),(311,-219))
cbezto((327,-243),(328,-287),(311,-315))
cbezto((295,-341),(270,-355),(229,-359))
rt(7.2)
fd(89)
rt(90)
fd(184)
end_fill()
color('white')
up()
lt(106.5)
fd(405.6)
down()
begin_fill()
rt(127.7)
fd(77.3)
rt(136.1)
fd(78)
rt(112.6)
fd(58)
end_fill()
up()
lt(175.7)
fd(470.3)
down()
begin_fill()
rt(175.7)
fd(34)
rt(90)
fd(116)
rt(90)
fd(34)
cbezto((260,-209),(275,-237),(276,-260))
cbezto((278,-297),(261,-324),(220,-325))
end_fill()
up()
hideturtle()
done()
No comments:
Post a Comment