# setting bounds for parametric-plot3d

I am trying to represent the part of a parametric surface contained in a cube of given coordinates. What I would like to do is to first compute a large part of the surface, then clip it to the given cube. I do not see how to do that; there is an option bounding_box(), but I did not find any documentation on it, and I do not understand what it does.

edit retag close merge delete

Sort by » oldest newest most voted For a treatment after creating the plot, there is now "add_condition"

          x,y,z = var('x,y,z')
P = implicit_plot3d(z-x*y,(-2,2),(-2,2),(-2,2))
def condi(x,y,z):
return bool(x*x+y*y+z*z <= Integer(1))

more The key is the add_condition method already mentioned by @FrédericC in his answer. Anyway, since the O.P. deals with parametric surfaces, I provide a complete example:

var("u,v")
S = parametric_plot3d(((2+cos(v))*cos(u), (2+cos(v))*sin(u), sin(v)), (u,0,2*pi), (v,0,2*pi))
S.show(viewer="threejs")
p1 = (-3,-2,-1)
p2 = (3,2,0.5)
def cond(*xyz):
return all([t<=t<=t for t in zip(p1,xyz,p2)])


This code first shows a torus, then the same torus clipped by the box determined by two given points p1 and p2. See this SageMath Cell. Concerning the second argument of add_condition, the docs indicates that it is the number of steps used on the boundary to cut the triangles that are not entirely within the domain; the larger this argument is, the smoother the boundary is.

more