MATHEMATICS

Minggu, 17 Juli 2011

About spheres in Mathematica

Plotting a sphere in Mathematica is simple.

Graphics3D[Sphere[]]


What really happens ? Another method to plot a sphere is the following. But let's do a circle in 3D first.

ParametricPlot3D[{Cos[t], Sin[t], 0}, {t, 0, 2 \[Pi]}]


We can then simply rotate this circle as follows:

ParametricPlot3D[{Cos[t] Cos[u], Cos[u] Sin[t], Sin[u]}, {t, 0, 2 \[Pi]}, {u, 0, 2 \[Pi] }]


ParemetricPlot3D generates data we can use in Graphics3D:

sphere = First[ ParametricPlot3D[{Cos[t] Cos[u], Cos[u] Sin[t], Sin[u]}, {t, 0, 2 \[Pi]}, {u, 0, 2 \[Pi] }]]

A very large output was generated. Here is a sample of it:
GraphicsComplex[{{1.,4.48799*10^-7,4.48799*10^-7},{0.900969,0.433884,4.48799*10^-7},{0.62349,0.781832,4.48799*10^-7},<<2873>>,{-0.270598,-0.270598,-0.92388},{0.353553,-0.146447,-0.92388}},{{<<1>>},{{},<<3>>,{<<1>>}}},VertexNormals->{<<1>>}]
Show Less\[ThinSpace]Show More\[ThinSpace]Show Full Output\[ThinSpace]Set Size Limit...


Graphics3D[sphere]


Note the difference between Sphere[] a Mathematica function, and the variable sphere which we assigned the first element in the list generated by the ParametricPlot3D function.

Tidak ada komentar:

Posting Komentar