Skip to content

Instantly share code, notes, and snippets.

@geojackass
Created December 25, 2014 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geojackass/4c65f21a4d8c839e1ef8 to your computer and use it in GitHub Desktop.
Save geojackass/4c65f21a4d8c839e1ef8 to your computer and use it in GitHub Desktop.
itokawa <- read.table("itokawa_f0049152.txt", skip=1, nrow=25350)
x <- itokawa[,2]
y <- itokawa[,3]
z <- itokawa[,4]
#package rglを呼び出す
library(rgl)
#lim指定を行う
plot3d(x = x, y = y, z = z, xlim=c(-0.4, 0.4), ylim=c(-0.4, 0.4), zlim=c(-0.4, 0.4))
itokawa_nasa <- read.table("ver64q.tab", skip=1, nrow=25350)
x1 <- itokawa_nasa[,2]
y1 <- itokawa_nasa[,3]
z1 <- itokawa_nasa[,4]
plot3d(x = x1, y = y1, z = z1, xlim=c(-0.4, 0.4), ylim=c(-0.4, 0.4), zlim=c(-0.4, 0.4))
#3dモデルを重ね書きする時はpoints3dを使用する
points3d(x, y, z)
par(new=T)
points3d(x1, y1, z1, col="RED")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment