Mathematica RegionPlot on the surface of the unit sphere?

后端 未结 4 1675
无人共我
无人共我 2021-02-13 22:49

I am using RegionPlot3D in Mathematica to visualise some inequalities. As the inequalities are homogeneous in the coordinates they are uniquely determined by their

4条回答
  •  [愿得一人]
    2021-02-13 23:41

    Simon beat me to the punch but here's a similar idea, based on lower level graphics. I deal with linear, homogeneous inequalities of the form Ax>0.

    A = RandomReal[{0, 1}, {8, 3}];
    eqs = And @@ Thread[
        A.{Sin[phi] Cos[th], Sin[phi] Sin[th], Cos[phi]} >
            Table[0, {Length[A]}]];
    twoDPic = RegionPlot[eqs,
        {phi, 0, Pi}, {th, 0, 2 Pi}];
    pts2D = twoDPic[[1, 1]];
    spherePt[{phi_, th_}] := {Sin[phi] Cos[th], Sin[phi] Sin[th], 
        Cos[phi]};
    rpSphere = Graphics3D[GraphicsComplex[spherePt /@ pts2D,
       twoDPic[[1, 2]]]]
    

    Let's compare it against a RegionPlot3D.

    rp3D = RegionPlot3D[And @@ Thread[A.{x, y, z} >
          Table[0, {Length[A]}]],
     {x, -2, 2}, {y, -2, 2}, {z, -2, 2},
       PlotStyle -> Opacity[0.2]];
    Show[{rp3D, rpSphere}, PlotRange -> 1.4]
    

提交回复
热议问题