File:Body centered cubic 35 balls.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file(SVG file, nominally 360 × 320 pixels, file size: 5 KB)

Summary

Description
English: 35 balls forming eight unit cells of the body-centered cubic lattice
Date
Source Own work
Author David Eppstein

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Source code

This image was created as an SVG file by the following source code:

from PADS import SVG
from math import sqrt,tan,asin
import sys

layers = 2
n = layers**3 + (layers + 1)**3

def ccube(x,y,z):
    return (x & 1) == (y & 1)
dims = range(-layers,layers+1)
rdims = range(layers,-layers-1,-1)
points = [(x,y,z) for x in rdims for y in dims for z in dims
          if x&1 == y&1 == z&1]

pov = (-20,-3.7,6.5)
x,y,z = 2,1,0
radius = 0.65
scale = 1000.0

def distance(p,q):
    return sqrt(sum([(p[i]-q[i])**2 for i in (x,y,z)]))
 
def perspective(loc):
    dz = loc[z]-pov[z]
    return (loc[x]-pov[x])*scale/dz, (loc[y]-pov[y])*scale/dz

bbox = 360+320j
output = SVG.SVG(bbox,sys.stdout)

output.element("defs",1)
output.element('radialGradient id = "light" cx = "50%" cy = "50%" fx = "70%" fy = "15%" r = "55%"',1)
output.element('stop stop-color = "rgb(255,255,255)" offset = "0%"')
output.element('stop stop-color = "rgb(200,200,240)" offset = "15%"')
output.element('stop stop-color = "rgb(0,0,180)" offset = "100%"')
output.element("radialGradient",-1)
output.element("defs",-1)

def vertex(p):
    lx,ly = perspective(p)
    lx += 520
    ly -= 40
    prad = scale*1.1*tan(asin(radius/(distance(p,pov))))
    output.circle(lx+ly*1j,prad,fill=SVG.colors.blue)
    output.circle(lx+ly*1j,prad,fill="url(#light)")

for p in points:
    vertex(p)

output.close()

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

4 December 2013

image/svg+xml

d1800c67dfafa2331df242caab5881afa2feeaac

5,556 byte

320 pixel

360 pixel

File history

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

Date/TimeThumbnailDimensionsUserComment
current01:52, 5 December 2013Thumbnail for version as of 01:52, 5 December 2013360 × 320 (5 KB)David EppsteinIllustrator and Wikipedia disagree on what fy= means for radialGradients
01:51, 5 December 2013Thumbnail for version as of 01:51, 5 December 2013360 × 320 (5 KB)David EppsteinUser created page with UploadWizard
The following pages on the English Wikipedia use this file (pages on other projects are not listed):

Global file usage

The following other wikis use this file:

Metadata