Download or view mapDymaxion.frink in plain text format
/** Maps an image of the world onto an icosahedron using the the Buckminster
Fuller "Dymaxion" icosahedral projection.
*/
use Dymaxion.frink
// Download maps from http://planetpixelemporium.com/planets.html
//img = new image["file:mars_1k_color.jpg"]
//img = new image["https://planetary.s3.amazonaws.com/assets/images/4-mars/2018/20181109_mars_lander_map.jpg"]
//img = new image["file:earthmap1k.jpg"]
//img = new image["file:jupitermap.jpg"]
//img = new image["file:uranusmap.jpg"]
//img = new image["file:neptunemap.jpg"]
//img = new image["file:plutomap2k.jpg"]
//img = new image["file:pluto_color_mapmosaic.jpg"]
// https://assets.science.nasa.gov/dynamicimage/assets/science/psd/solar/2023/09/p/l/pluto_color_mapmosaic.jpg
img = new image["file:pluto_color_mapmosaic.jpg"]
img.show[]
img = img.unsharpMask[6,1] // Optional unsharp mask (also stretches contrast.)
img.show[]
w = img.getWidth[]
h = img.getHeight[]
longscale = 360 degrees / w
latscale = 180 degrees / h
gr = new graphics
gr.font["SansSerif", "bold", 1.5 degree]
stepSize = 1
diameter = 7.6 * stepSize / w
for iy = 0 to h-1 step stepSize
{
lat = -(iy*latscale) + 90 degrees
for ix = 0 to w-1 step stepSize
{
long = ix*longscale - 180 degrees
c = img.getPixelAsColor[ix,iy]
[x,y, tri] = Dymaxion.latLongToXY[lat, long, false]
gr.color[c]
gr.fillEllipseCenter[x,-y,diameter,diameter]
}
}
insets = 0.985
gr.write["pluto2.svg", 1000, undef, insets]
gr.write["pluto2.png", 4000, undef, insets]
gr.write["pluto2.jpg", 4000, undef, insets]
gr.show[insets]
Download or view mapDymaxion.frink in plain text format
This is a program written in the programming language Frink.
For more information, view the Frink
Documentation or see More Sample Frink Programs.
Alan Eliasen, eliasen@mindspring.com