12 lines
384 B
R
12 lines
384 B
R
library(lattice)
|
|
theta <- seq(0, pi, length.out=100)
|
|
phi <- seq(0, 2*pi, length.out=100)
|
|
x <- outer(sin(theta), cos(phi))
|
|
y <- outer(sin(theta), sin(phi))
|
|
z <- sqrt(1-x^2-y^2)
|
|
xx <- kronecker(matrix(1, 2, 2), x)
|
|
yy <- kronecker(matrix(1, 2, 2), y)
|
|
zz <- kronecker(matrix(c(1, -1, -1, 1), 2, 2), z)
|
|
png(filename="Sphere-R.png", width=1000, height=1000)
|
|
wireframe(zz ~ xx*yy)
|
|
dev.off()
|