2
$\begingroup$

Is it possible to define/code a new plot in 3D directly using Spherical coordinates imagined to be somewhat like:

ContourPlot3Dsph[{f[r,theta,phi]==0}, {phi,.5,3}, {theta,0,3}, {r,1,2}]

Although we may convert from Cartesian coordinates, the advantage would be to see surface with net of parametric lines $\phi= c_1, \theta=c_2, r= c_3 $ varied. In solid modeling it helps slightly better visualization of solid radial depth due to $r$ variation, or so I felt.

EDIT1:

i.e., while visualizing the surface I want to be able to see Gridlines/Net defined on spherical coordinates, but not as the usual slices of Cartesian cuts.The parametric lines are a set of cones vertexed at origin $\phi$, a set of meridians $\theta$, a set of sphere radii $r$.

$\endgroup$
  • 1
    $\begingroup$ You can use the substitution ro=Sqrt[x^2+y^2+z^2], fi=... putting these formulas directly inside the f(...). It will be like f(Sqrt[..],ArcTan[..], ArcTan[..]) and it will work with usual ContourPlot3D where the variables are {x,x0,x1}, {y,y0,y1},{z,z0,z1}. $\endgroup$ – Rom38 Jun 27 '18 at 7:41
2
$\begingroup$

You only need define mesh functions for spherical coordinates.

For r:

ContourPlot3D[x + y - z == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, 
    Mesh -> {{.8, 1, 1.3}}, MeshStyle -> Thick, 
    MeshFunctions -> {Function[{x, y, z}, Sqrt[x^2 + y^2 + z^2]]}]

enter image description here

For phi and theta:

ContourPlot3D[
   x^2 + y^2 + z^2 == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, 
   Mesh -> {{0 Degree, 10 Degree, -70 Degree}}, MeshStyle -> Thick, 
   MeshFunctions -> {Function[{x, y, z}, ArcTan[x, y]]}]

ContourPlot3D[
   x^2 + y^2 + z^2 == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, 
   Mesh -> {{20 Degree, 90 Degree, 120 Degree}}, MeshStyle -> Thick, 
   MeshFunctions -> {Function[{x, y, z}, ArcTan[z, Sqrt[x^2 + y^2]]]}]

With additional RegionFunction, you can e.g. restrict for 60 Degree < theta < 150 Degree

ContourPlot3D[x + y - z == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, 
    Mesh -> {{.8, 1, 1.3}}, MeshStyle -> Thick, 
    MeshFunctions -> {Function[{x, y, z}, Sqrt[x^2 + y^2 + z^2]]}, 
    RegionFunction -> 
    Function[{x, y, z}, 
    60 Degree < ArcTan[z, Sqrt[x^2 + y^2]] < 150 Degree]]
$\endgroup$
  • $\begingroup$ When only $\phi, \theta$ are parametrized we have a surface.When $r, \phi, \theta$ are parametrized we have a solid, or hollow solid.if meshed. $\endgroup$ – Narasimham Jun 28 '18 at 9:13

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.