Skip to content

Instantly share code, notes, and snippets.

@pepijn-devries
Created August 16, 2015 12:37
Show Gist options
  • Save pepijn-devries/5967a467cb3172bd47d1 to your computer and use it in GitHub Desktop.
Save pepijn-devries/5967a467cb3172bd47d1 to your computer and use it in GitHub Desktop.
# set up an rgl device with a black background
open3d(windowRect = c(100, 100, 250, 250))
bg3d("black")
# Remove all lights present and add a light to represent the sun
clear3d(type = "lights")
rgl.light(theta = 30, phi = 0, viewpoint.rel = T, ambient = "#FFFF66")
# Create a sphere on which the world topography is projected
persp3d(world_coords[["x"]], world_coords[["y"]], world_coords[["z"]],
col="white",
texture="world.topo.png",
specular="#303030", axes=FALSE, box=FALSE, xlab="", ylab="", zlab="",
normal_x = world_coords[["x"]], normal_y = world_coords[["y"]], normal_z = world_coords[["z"]])
# add a transparent sphere to model the Earth's atmosphere
persp3d(world_coords[["x"]]*1.05, world_coords[["y"]]*1.05, world_coords[["z"]]*1.05,
col = "#ADD8E6", specular = "black", alpha = 0.1, add = T)
mark_pos <- polar_to_cart(long = 5.5, lat = 52, alt = 1.06)
spheres3d(mark_pos[["x"]], mark_pos[["y"]], mark_pos[["z"]],
0.03, col = "red", add = T)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment