เอาสักดอกไหม

จาก http://www.sakngoi.com/2015/10/30/สมการดอกกุหลาบ/

library(misc3d)
rose <- function(x,theta,axis)
{
 phi <- (pi/2)*exp(-theta/(8*pi))
 X <- 1-(1/2)*((5/4)*(1- ((3.6 * theta) %% (2*pi))/pi)^2-1/4)^2
 y <- 1.95653* x*x * (1.27689 *x-1)^2 * sin(phi)
 r <- X*(x *sin(phi)+y*cos(phi))
 
 out<-switch(axis,
 x={
 r*sin(theta)
 },
 y={
 r*cos(theta)
 },
 z={
 (X*(x* cos(phi)-y* sin(phi)))
 }
 )
 return(out)
}

parametric3d(
 fx = function(u,v) rose(u,v,axis="x"),
 fy = function(u,v) rose(u,v,axis="y"),
 fz = function(u,v) rose(u,v,axis="z"),
 umin = 0,umax = 1,vmin = -2 *pi,vmax = 15*pi,
 screen=list(x=25,y=576),n=100, color = "red")