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

จาก 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")


 

สมการดอกกุหลาบ

Rose[x_,theta_]:=Module[{phi=(Pi/2)Exp[-theta/(8 Pi)],X=1-(1/2)((5/4)(1-Mod[3.6 theta,2 Pi]/Pi)^2-1/4)^2},
y=1.95653 x^2 (1.27689 x-1)^2 Sin[phi];
r=X(x Sin[phi]+y Cos[phi]);
{r Sin[theta],r Cos[theta],X(x Cos[phi]-y Sin[phi])}
];

ParametricPlot3D[Rose[x,theta],{x,0,1},{theta,-2 Pi,15 Pi},PlotPoints->{25,576},PlotStyle->Red,Mesh->None,Axes->False,Boxed->False]

rose

ลอกมาจาก www.bugman123.com