# Asymptote 3d plot of an implicit function (with absolute value)

When I run the following code, the program seems to go into an infinite loop. If I write a function without the abs function, the program runs normally. The resulting plot is similar to the picture given below. What is the problem with my code?

\documentclass[10pt,a4paper]{article}
\usepackage{lmodern}
\usepackage{asypictureB}
settings.outformat="png";
settings.render=8;
import graph3;
import smoothcontour3;

material surfacepen = material(white, emissivepen = gray(0.2));

%
\begin{document}
%
\begin{asypicture}{name=ellipsoid}
size(5cm,0);
currentprojection = orthographic(12/3,12/4,12/2);

real f(real x, real y, real z) {
return (abs(x))^(0.7) + (abs(y))^(0.7) + (abs(z))^(0.7) - 1;
}

draw(implicitsurface(f, (-1,-1,-1), (1,1,1), overlapedges=true), surfacepen=surfacepen);

xaxis3(Label("$x$",1),-4,4,blue);
yaxis3(Label("$y$",1),-4,4,blue);
zaxis3(Label("$z$",1),-4,4,blue);

\end{asypicture}

\end{document}


Due to the power 0.7, the surface is not smooth in x=0 or y=0 or z=0. Even if you try implicitsurface(f,(0,0,0),(1,1,1)) I am not sure that the computation will stop. With (0.001,0.001,00.001) it is ok but the surface is not complete.

Here you have a not-too-complicated expression : it is possible to give a parametric of the part with non negative coordinates. Here a possible solution

import graph3;
//import smoothcontour3;
import palette;
material surfacepen = material(white, emissivepen = gray(0.2));

size(5cm,0);
//currentprojection = orthographic(12/3,12/4,12/2);

triple g(pair t){return (t.x, (1-(t.x)^.7)^(1/.7)*t.y,(1-(t.x)^.7-((1-(t.x)^.7)^(1/.7)*t.y)^.7)
);}
surface s0=surface(g,(0,0),(1,1),30,30,Spline);
surface s1=rotate(90,(0,0,0),(0,0,1))*s0;
surface s2=rotate(180,(0,0,0),(0,0,1))*s0;
surface s3=rotate(270,(0,0,0),(0,0,1))*s0;

surface s=surface(s0,s1,s2,s3);
surface sb=reflect((0,0,0),X,Y)*s;
draw(s,surfacepen=surfacepen);
draw(sb,surfacepen=surfacepen);


and a screenshot of the result (I have some OpenGL pb)

Perhaps that a polar parametric could be better.