Download or view inverseSinusoidal.frink in plain text format
/** This draws an inverse sinusoidal projection, suitable for mapping a drawing
onto a sphere. */
longStep = 15 degrees
latStep = 10 degrees
g = new graphics
g.color[0,0,0,.3]
lastY = 0 degrees
for lat = 0 degrees to 90 degrees step latStep
{
g.line[-180 deg, lat, 180 deg, lat]
g.line[-180 deg, -lat, 180 deg, -lat]
}
for long = longStep/2 to 180 degrees step longStep
{
lastX = long
lastY = 0 degrees
LAT:
for lat = 0 deg to 90 degrees step latStep/20
{
longScale = 1 / cos[lat]
x = long * longScale
if x > 180 degrees
break LAT
g.line[x, lat, lastX, lastY]
g.line[-x, lat, -lastX, lastY]
g.line[x, -lat, lastX, -lastY]
g.line[-x, -lat, -lastX, -lastY]
lastX = x
lastY = lat
}
}
g.drawRectSides[-180 deg, 90 deg, 180 deg, -90 deg]
g.show[]
Download or view inverseSinusoidal.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 was born 20217 days, 23 hours, 18 minutes ago.