Ask Your Question
1

Thicker plot in implicit_plot3d

asked 2020-07-31 17:40:17 +0100

ConfusedMark gravatar image

updated 2020-07-31 17:42:29 +0100

I'm graphing a surface in implicit_plot3d and then cutting away part of it to reveal another surface that was hidden behind it. Is there a way to "thicken" the plotted surface, so that the edge is still visible in places where we are looking at it straight-on?

For a simple example, how can I graph the part of $x^2+y^2+z^2 = 1$ with $z \leq 1/2$, while making the sphere a bit thicker than the default?

edit retag flag offensive close merge delete

Comments

Please post any current attempt. It will be easier to answer starting from that.

slelievre gravatar imageslelievre ( 2020-07-31 22:29:52 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-08-03 07:35:39 +0100

slelievre gravatar image

So far Sage has no built-in way to thicken a surface.

For a simple surface as in the question, one could plot

  • the surface and its boundary curve,

or one could plot

  • a surface slightly inside,
  • a surface slightly outside,
  • an edge surface,

and combine the three plots to produce the desired result.

Both approaches are illustrated below.

Define useful constants:

sage: one = RDF.one()
sage: eps = one/64
sage: b = one + 2*eps
sage: h = one/2
sage: rh = RDF(3).sqrt()/2
sage: tau = 2*RDF.pi()

Plot the surface and the boundary curve:

sage: ro = one
sage: fo = lambda x, y, z: x*x + y*y + z*z - ro*ro
sage: xo = lambda t: rh*cos(tau*t)
sage: yo = lambda t: rh*sin(tau*t)
sage: zo = lambda t: h

sage: sopt = {'color': 'gold', 'plot_points': 77}
sopt: copt = {'color': 'crimson'}

sage: so = implicit_plot3d(fo, (-b, b), (-b, b), (-b, h), **sopt)
sage: co = parametric_plot([xo, yo, zo], (0, 1), **copt)
sage: go = so + co
sage: go.show(frame=False)
Launched html viewer for Graphics3d Object

Plot inner, outer and edge surfaces:

sage: rm = ro - eps
sage: rp = ro + eps
sage: fm = lambda x, y, z: x*x + y*y + z*z - rm*rm
sage: fp = lambda x, y, z: x*x + y*y + z*z - rp*rp

sage: rhm = (rm*rm - h*h).sqrt()
sage: rhp = (rp*rp - h*h).sqrt()
sage: xe = lambda u, v: ((1 - u)*rhm + u * rhp)*cos(tau*v)
sage: ye = lambda u, v: ((1 - u)*rhm + u * rhp)*sin(tau*v)
sage: ze = lambda u, v: h

sage: sm = implicit_plot3d(fm, (-b, b), (-b, b), (-b, h), **sopt)
sage: sp = implicit_plot3d(fp, (-b, b), (-b, b), (-b, h), **sopt)
sage: se = parametric_plot3d([xe, ye, ze], (0, 1), (0, 1), **sopt)
sage: st = sp + sm + se

sage: st.show(frame=False)
Launched html viewer for Graphics3d Object
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2020-07-31 17:40:17 +0100

Seen: 333 times

Last updated: Aug 03 '20