Hello,
The code below plots the rounded cube shown on the image. The color = :yellow
argument has no effect. How to plot the cube with a single color? The document of surface
says nothing about the keywords arguments.
using Makie, GLMakie
function r(phi; a, b, m, n1, n2, n3)
return 1 / (abs(cos(m*phi/4)/a)^n2 + (abs(sin(m*phi/4)/b)^n3))^(1/n1)
end
function supershape(p1, p2)
phi = (-pi/2):0.01:(pi/2)
theta = (-pi):0.01:(pi)
x = [
r(theta; a=p1.a, b=p1.b, m=p1.m, n1=p1.n1, n2=p1.n2, n3=p1.n3) * cos(theta) *
r(phi; a=p2.a, b=p2.b, m=p2.m, n1=p2.n1, n2=p2.n2, n3=p2.n3) * cos(phi)
for phi in phi, theta in theta
]
y = [
r(theta; a=p1.a, b=p1.b, m=p1.m, n1=p1.n1, n2=p1.n2, n3=p1.n3) * sin(theta) *
r(phi; a=p2.a, b=p2.b, m=p2.m, n1=p2.n1, n2=p2.n2, n3=p2.n3) * cos(phi)
for phi in phi, theta in theta
]
z = [
r(phi; a=p2.a, b=p2.b, m=p2.m, n1=p2.n1, n2=p2.n2, n3=p2.n3) * sin(phi)
for phi in phi, theta in theta
]
return (x = x, y = y, z = z)
end
params1 = (a=1, b=1, m=4, n1=10, n2=10, n3=10)
params2 = params1
x, y, z = supershape(params1, params2)
fig, _ = surface(x, y, z; color = :yellow)
fig