7
$\begingroup$

How do I draw the intersection of these functions?

SphericalPlot3D[{Csc[ϕ], Sqrt[2]}, {θ, 0, 2 π}, {ϕ, 0, π}, 
    BoxRatios -> {1, 1, 1}, AxesLabel -> {x, y, z}, Mesh -> None, 
    PlotRange -> {-1.5, 1.5}, PlotStyle -> Directive[Blue, Opacity[0.1]]]

$\endgroup$
2
  • $\begingroup$ If you can convert them to implicit forms, you can use the techniques in answers to this question $\endgroup$
    – rm -rf
    Sep 15, 2013 at 19:26
  • $\begingroup$ I've seen the question before asking. I've tried to get the form, but it's another problem. $\endgroup$
    – user28936
    Sep 15, 2013 at 20:02

1 Answer 1

8
$\begingroup$

You can use MeshFunctions on one of the plots, adapting the other function for the mesh function.

With[{opts = {BoxRatios -> {1, 1, 1}, AxesLabel -> {"x", "y", "z"}, 
    PlotRange -> {-1.5, 1.5}, PlotStyle -> Directive[Blue, Opacity[0.1]]}},
 Show[
  SphericalPlot3D[
   Csc[φ], {θ, 0, 2 π}, {φ, 0, π}, 
   Mesh -> None, opts],
  SphericalPlot3D[Sqrt[2], {θ, 0, 2 π}, {φ, 0, π},
   Mesh -> {{0.}}, 
   MeshFunctions -> {Function[{x, y, z, θ, φ, r}, 1/r - Sin[φ]]},
   BoundaryStyle -> None, opts]
  ]
 ]

Mathematica graphics

Or, in this case, one could solve explicitly for the intersection (φ equals π/4, 3π/4).

SphericalPlot3D[{Csc[φ], Sqrt[2]},
 {θ, 0, 2 π}, {φ, 0, π},
 BoxRatios -> {1, 1, 1}, AxesLabel -> {"x", "y", "z"},
 Mesh -> {{π/4, 3 π/4}}, MeshFunctions -> {Function[{x, y, z, θ, φ, r}, φ]}, 
 PlotRange -> {-1.5, 1.5}, PlotStyle -> Directive[Blue, Opacity[0.1]],
 BoundaryStyle -> None]

Sometimes it is necessary to increase PlotPoints to get a smooth mesh line for the intersection.

You can plot the intersection without the surface with the setting PlotStyle -> None.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.