1 | initial version |

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[0]<=t[1]<=t[2] for t in zip(p1,xyz,p2)])
S.add_condition(cond,50).show(viewer="threejs")
```

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 is this argument, the smoother is the boundary.

2 | No.2 Revision |

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[0]<=t[1]<=t[2] for t in zip(p1,xyz,p2)])
S.add_condition(cond,50).show(viewer="threejs")
```

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 ~~is ~~this ~~argument, ~~argument is, the smoother ~~is ~~the ~~boundary.~~boundary is.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.