0

The following code(plotting disk in 3D) is very slow in Mathematica, how to optimize the code?

center = {0, 0, 1};
normalAxis = {0, 0, 1};
radius = 1;

region = DiscretizeRegion@ImplicitRegion[ { Dot[{x, y, z} - center, normalAxis] == 0 && Norm[{x, y, z} - center] <= radius }, {x, y, z}]

David G. Stork
  • 41,180
  • 3
  • 34
  • 96
Chris Guo
  • 149
  • 8
  • Why do you Normalize a normalized vector?? Why do you define radius when you could simply place $1$ in the code? – David G. Stork Jul 05 '21 at 03:28
  • Why not ParametricPlot3D[{0, 0, 1} + r {Cos[\[Theta]], Sin[\[Theta]], 0}, {\[Theta], 0, 2 \[Pi]}, {r, 0, 1}] – David G. Stork Jul 05 '21 at 03:35
  • I want to make other operations based on ImplicitRegion. e.g. Projecting some shapes onto sphere. – Chris Guo Jul 05 '21 at 03:41
  • I took these code snippets from my code, I replace the variables with constants, please ignore the normalize and unit radius. I think remain the variable names in code could make the code more readable. – Chris Guo Jul 05 '21 at 03:43
  • What is Projecting some shapes onto sphere? – cvgmt Jul 05 '21 at 04:18
  • Here is an example(sorry for my poor English): https://mathematica.stackexchange.com/questions/83550/projection-of-triangles-onto-a-sphere – Chris Guo Jul 05 '21 at 04:42
  • 1
    Here it is pretty much instantaneous. 12.3.0 for Mac OS X x86 (64-bit) (May 10, 2021) – A.G. Jul 05 '21 at 05:01
  • same here, it is instantaneous in 12.3.0 for Win10 (64-bit) – MMA13 Jul 05 '21 at 07:47

0 Answers0