p.op().stroked(colour.orange()).text(pos(), 'orange') p.op().stroked(colour.yellow()).text(pos(), 'yellow') p.op().stroked(colour.lime()).text(pos(), 'lime') p.op().stroked(colour.green()).text(pos(), 'green') p.op().stroked(colour.cyan()).text(pos(), 'cyan') p.op().stroked(colour.blue()).text(pos(), 'blue') p.op().stroked(colour.magenta()).text(pos(), 'magenta') p.op().stroked(colour.white()).text(pos(), 'white') p.op().stroked(colour.black()).text(pos(), 'black') p.op().stroked(colour.purple()).text(pos(), 'purple') p.op().stroked(colour.brown()).text(pos(), 'brown') p.op().stroked(colour.pink()).text(pos(), 'pink') p.op().stroked(colour.dark_grey()).text(pos(), 'dark grey') p.op().stroked(colour.grey()).text(pos(), 'grey') p.op().stroked(colour.mid_grey()).text(pos(), 'mid-grey') p.op().stroked(colour.light_grey()).text(pos(), 'light grey') p.op().stroked(colour.black()).text(pos(), 'black') p.op().stroked(colour.rgb((.9, .7, .5))).text(pos(), 'rgb') #for i in xrange (-24, 25): #for i in xrange (0, 25): # h = i / 4 # text = 'hue=' + str(h) # p.op().stroked(colour.hue(h)).text (pos(), text) #for i in xrange (0, 11): # v = i / 10 # text = 'grey=' + str(v) # p.op().stroked(colour.grey(v)).text (pos(), text)
from pypyx.pypyx import colour, pic, pypyx_maths p = pic(scale=4.0) o = (0, 0) d = maths.sqrt(3) / 2 ### o'clock positions d2 = (d, .5) d4 = (d, -.5) d6 = (0, -1) d8 = (-d, -.5) d10 = (-d, .5) d12 = (0, 1) p.op().stroked(colour.grey()).line((-d / 2, .25), (d / 2, .75)) p.op().stroked(colour.grey()).line((d / 2, .25), (-d / 2, .75)) mj = d / maths.sqrt(2) mn = mj / maths.sqrt(3) p.op().dashed().stroked("red").ellipse((d / 2, -.25), mj, mn, pypyx_maths.degrees(60)) p.op().dashed().stroked("green").ellipse((0, .5), mj, mn, pypyx_maths.degrees(0)) p.op().dashed().stroked("blue").ellipse((-d / 2, -.25), mj, mn, pypyx_maths.degrees(-60)) p.op().stroked("red").ellipse((d / 2, -.25), mj / 2, mn / 2, pypyx_maths.degrees(60)) p.op().stroked("green").ellipse((0, .5), mj / 2, mn / 2,
p.op().stroked(colour.orange()).text (pos(), 'orange') p.op().stroked(colour.yellow()).text (pos(), 'yellow') p.op().stroked(colour.lime()).text (pos(),'lime') p.op().stroked(colour.green()).text (pos(), 'green') p.op().stroked(colour.cyan()).text (pos(), 'cyan') p.op().stroked(colour.blue()).text (pos(), 'blue') p.op().stroked(colour.magenta()).text (pos(), 'magenta') p.op().stroked(colour.white()).text (pos(), 'white') p.op().stroked(colour.black()).text (pos(), 'black') p.op().stroked(colour.purple()).text (pos(), 'purple') p.op().stroked(colour.brown()).text (pos(), 'brown') p.op().stroked(colour.pink()).text (pos(), 'pink') p.op().stroked(colour.dark_grey()).text (pos(), 'dark grey') p.op().stroked(colour.grey()).text (pos(), 'grey') p.op().stroked(colour.mid_grey()).text (pos(), 'mid-grey') p.op().stroked(colour.light_grey()).text (pos(), 'light grey') p.op().stroked(colour.black()).text (pos(), 'black') p.op().stroked(colour.rgb((.9,.7,.5))).text (pos(), 'rgb') #for i in xrange (-24, 25): #for i in xrange (0, 25): # h = i / 4 # text = 'hue=' + str(h) # p.op().stroked(colour.hue(h)).text (pos(), text) #for i in xrange (0, 11): # v = i / 10 # text = 'grey=' + str(v) # p.op().stroked(colour.grey(v)).text (pos(), text)
from pypyx.pypyx import colour, pic, pypyx_maths p = pic (scale = 4.0) o = (0, 0) d = maths.sqrt(3) / 2 ### o'clock positions d2 = (d, .5) d4 = (d, -.5) d6 = (0, -1) d8 = (-d, -.5) d10 = (-d, .5) d12 = (0, 1) p.op().stroked(colour.grey()).line ((-d/2, .25), (d/2, .75)) p.op().stroked(colour.grey()).line ((d/2, .25), (-d/2, .75)) mj = d / maths.sqrt(2) mn = mj / maths.sqrt(3) p.op().dashed().stroked("red").ellipse((d/2, -.25), mj, mn, pypyx_maths.degrees(60)) p.op().dashed().stroked("green").ellipse((0, .5), mj, mn, pypyx_maths.degrees(0)) p.op().dashed().stroked("blue").ellipse((-d/2, -.25), mj, mn, pypyx_maths.degrees(-60)) p.op().stroked("red").ellipse((d/2, -.25), mj/2, mn/2, pypyx_maths.degrees(60)) p.op().stroked("green").ellipse((0, .5), mj/2, mn/2, pypyx_maths.degrees(0)) p.op().stroked("blue").ellipse((-d/2, -.25), mj/2, mn/2, pypyx_maths.degrees(-60)) p.op().line (o, d2) p.op().line (o, d10)
#!/usr/bin/env python # -*- coding: UTF-8 -*- from __future__ import division import math as maths import os from pypyx.pypyx import colour, pic p = pic (scale = 1) num_pts = 5 step = 2 r = 0.5 tau = 2 * maths.pi pts = [] for idx in xrange(0, num_pts): a = tau * idx * step / num_pts x = r * maths.sin(a) y = r * maths.cos(a) pts.append ((x, y)) p.op().parity_winding().filled(colour.grey(0.5)).closed().poly_line ( pts ) p.output_pdf (os.path.splitext(__file__)[0])
#!/usr/bin/env python # -*- coding: UTF-8 -*- from __future__ import division import math as maths import os from pypyx.pypyx import colour, pic p = pic(scale=1) num_pts = 5 step = 2 r = 0.5 tau = 2 * maths.pi pts = [] for idx in xrange(0, num_pts): a = tau * idx * step / num_pts x = r * maths.sin(a) y = r * maths.cos(a) pts.append((x, y)) p.op().parity_winding().filled(colour.grey(0.5)).closed().poly_line(pts) p.output_pdf(os.path.splitext(__file__)[0])