Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
1

Thicker plot in implicit_plot3d

asked 4 years ago

ConfusedMark gravatar image

updated 4 years ago

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 x2+y2+z2=1 with z1/2, while making the sphere a bit thicker than the default?

Preview: (hide)

Comments

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

slelievre gravatar imageslelievre ( 4 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 4 years ago

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
Preview: (hide)
link

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: 4 years ago

Seen: 353 times

Last updated: Aug 03 '20