#Librerías necesarias
install.packages("rgl")
install.packages("magick")
#Codigo
library("rgl")
library("magick")
open3d()
theta <- seq(0, 2*pi, len = 25)
knot <- cylinder3d(
center = cbind(
sin(theta) + 2*sin(2*theta),
2*sin(3*theta),
cos(theta) - 2*cos(2*theta)),
e1 = cbind(
cos(theta) + 4*cos(2*theta),
6*cos(3*theta),
sin(theta) + 4*sin(2*theta)),
radius = 0.8,
closed = TRUE)
shade3d(addNormals(subdivision3d(knot, depth = 2)), col = "green");
#Giro Automatico
play3d( spin3d( axis = c(0, 0, 1), rpm = 7), duration = 100 )
# O Generar Gif
movie3d( spin3d( axis = c(0, 0, 1), rpm = 7),
duration = 10, dir = getwd(),
type = "gif", clean = TRUE )
###################################################
install.packages("rgl")
install.packages("magick")
library("rgl")
library("magick")
open3d()
theta <- seq(0, 2*pi, len = 25)
knot <- cylinder3d(
center = cbind(
sin(theta) + 2*sin(2*theta),
2*sin(3*theta),
cos(theta) - 2*cos(2*theta)),
e1 = cbind(
cos(theta) + 4*cos(2*theta),
6*cos(3*theta),
sin(theta) + 4*sin(2*theta)),
radius = 0.8,
closed = TRUE)
shade3d(addNormals(subdivision3d(knot, depth = 2)), col = "green");
play3d( spin3d( axis = c(0, 0, 1), rpm = 7), duration = 100 )
###################################################