File:Spaceship Ford circles (complete).png

From LifeWiki
Jump to navigation Jump to search

Original file(8,192 × 8,192 pixels, file size: 1.39 MB, MIME type: image/png)

Summary

Like File:Spaceship_ford_circles.png, however with all things in the spaceship section, most notably c/10 and 3c/7 orthogonal, and smaller circles representing those with non-coprime displacements and periods (ie. higher periods than necessary for their speeds), and underneath it are known speeds of diagonal spaceships. Mayhaps I will add pictures of spaceships later like the original one

Python program (with optional bitwise mode, though it seems not to be so fast and is less accurate than PIL.ImageDraw)

from dronery import *
from PIL import Image,ImageDraw
bitwise=False
lims=2*((0,1),)
size=2*(1<<11+2*(not bitwise),)
pixels=int.__mul__(*size)

relu=lambda n: n>0 and n #rectified linear
if bitwise: state=0
else:
    img=Image.new('RGB',size)
    state=ImageDraw.Draw(img)
def circle(xc,yc,r,col):
    global state
    if bitwise:
        for y in range(yc-r,min(yc+r+1,size[1])):
            mask=~(~0<<24*min((w:=isqrt(r**2-(y-yc)**2))<<1|1,size[0]+w-xc))//~(~0<<24)<<relu(24*(xc-w+size[0]*y))
            state&=~mask*~(~0<<24)
            state|=mask*col
    else:
        for xo in (0,size[0]): #hugs and kisses
            for yo in (size[1]>>1,3*size[1]>>1): state.ellipse((xo-xc-r,yo-yc-r,-xc+xo+r,-yc+yo+r),fill=col,outline=0)
fraction=lambda p,q,col,dir: circle((q!=1 and q-p)*size[0]//q,*(r:=size[1]//q**2>>1,size[1]+~r if dir else r)[::-1],col)
orth=sap(lambda n: (1,n),range(2,8))|{(1,10),(2,5),(2,7),(3,7)}|{(2,4),(3,6),(2,6),(4,8),(2,8),(3,9),(5,10),(4,10),(2,10),(6,12),(4,12),(3,12),(2,12),(7,14),(5,15),(3,15),(8,16),(9,18),(6,18),(3,18),(10,20),(2,20),(6,21),(11,22),(12,24),(12,28),(6,30),(18,36)}
orthc={(17,45),(31,240),(1,2)}
diag=sap(lambda n: (1,n),range(4,9))|{(2,8),(3,12)}
diagc={(8,96)}
for i,(d,c) in enumerate(((orth,orthc),(diag,diagc))):
    for q in range(1,23<<(not bitwise)):
        for p in range(q):
            if (True or gcd(p,q)==1) and (q==1 or p): fraction(p,q,(0xff00 if (p,q) in d else 0xffff if (p,q) in c else 0x77ff if not(i) and 4*p<q else 0xff) if p<<i+1<=q>1 else 0x777777,i) #0xff<<(((p,q) in d)<<3)
if bitwise:
    state=state<<(pixels>>1)*24&~(~0<<pixels*24)|state>>(pixels>>1)*24
    img=Image.frombytes('RGB',size,state.to_bytes(length=3*pixels))#.transpose(5)
img.show()

Note that PIL is deprecated, I think, pillow is the one you want (though it is confusingly imported by the same name)

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current17:58, 20 August 2023
Error creating thumbnail: File with dimensions greater than 64 MP
8,192 × 8,192 (1.39 MB)DroneBetter (talk | contribs)Like File:Spaceship_ford_circles.png, however with all things in the spaceship section, most notably c/10 and 3c/7 orthogonal, and smaller circles representing those with non-coprime displacements and periods (ie. higher periods than necessary for their speeds), and underneath it are known speeds of diagonal spaceships. Mayhaps I will add pictures of spaceships later like the original one Python program (with optional bitwise mode, though it seems not to be so fast and is less accurate...

There are no pages that use this file.