# The boundary of an implicit_plot3d are jittery.

I am making a contour plot in a restricted region using the following commands:

var('x,y,z')

implicit_plot3d((x^2+y^2-.4)*(x^2+z^2-.4)*(z^2+y^2-.4)*(x^2+(y-z)^2/2-.4)*(z^2+(x-y)^2/2-.4)*(y^2+(x-z)^2/2-.4)*(x^2+(y+z)^2/2-.4)*(z^2+(x+y)^2/2-.4)*(y^2+(x+z)^2/2-.4)==1, (x, -3, 3), (y, -3,3), (z, -3,3), color='green', plot_points=100, region=lambda x,y,z: x^2+y^2+z^2<10)


The surface is restricted to a ball, using the region command. This is because I need to illustrate a surface with its boundary meeting the corresponding sphere.

My problem is that some of the boundary cylinders have their border very jittery. They look like a saw. I need them to be smooth, as some others actually are.

I tried using Adaptative=true, without any success. The same problem also applies when I use tachyon to render rather than jmol.

Any suggestions would be welcome.

Thank you

edit retag close merge delete

Sort by » oldest newest most voted you can now use the add_condition method as follows

sage: x,y,z=var('x,y,z')
sage: P = implicit_plot3d((x^2+y^2-.4)*(x^2+z^2-.4)*(z^2+y^2-.4)*(x^2+(y-z)^2/2-.4
....: )*(z^2+(x-y)^2/2-.4)*(y^2+(x-z)^2/2-.4)*(x^2+(y+z)^2/2-.4)*(z^2+(x+y)^2/2-
....: .4)*(y^2+(x+z)^2/2-.4)==1, (x, -3, 3), (y, -3,3), (z, -3,3), color='green'
....: , plot_points=100)
sage: def condition(x,y,z):
....:     return x^2+y^2+z^2<10
sage: Q

more

Neat plot! To some extent it is unavoidable, if you have a tube at an odd angle in 3-d then the plot sample points will not line up in the direction of the tube. So no matter how you join the vertices into triangles, it'll always be jagged. If you need visual perfection then you probably have to use tachyon and crank up plot_points to have triangles that are only a few pixels wide.

more