Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.2K Views
|
1 Reply
|
1 Total Like
View groups...
Share
Share this post:

Avoid jagged edges on spheres?

These are Ce and Rh atoms shifted by a small amount (crystallography). Somehow, I cannot get the jagged edges to dissappear. Any suggestions?

Graphics3D[{Blue, Sphere[latposCe20, 2.5], Green, 
  Sphere[latposCe80, 2.5], Red, Sphere[latposRh20, 1.2], Yellow, 
  Sphere[latposRh80, 1.2]}, ViewPoint -> {20, 0, 0}, Boxed -> False]

Jagged edges with spheres

POSTED BY: Jean Guy Lussier

There are (at least) two ways of solving this:

Either increase the so-called SpherePoints to a large number:

Graphics3D[{Red, Sphere[{0, 0, 0}, 1], Yellow, Sphere[{0, 0, 0.001}, 1]}, Method -> {"SpherePoints" -> 1000}]

Or (better I think), create a custom function that plots colored-half-spheres:

ClearAll[ColoredHalfSpheres]
ColoredHalfSpheres[p:{x_,y_,z_},r_,col:{color1_,color2_}]:=
Translate[First@SphericalPlot3D[{r,-r},{\[Theta],0,Pi/2},{\[Phi],0,2Pi},Mesh->None,PlotStyle->col,Axes->False,Boxed->False],p]

Graphics3D[ColoredHalfSpheres[{1, 2, 3}, 0.4, {Red, Blue}], Axes -> True]

Note that the first solution is very memory/graphics intense because it creates many many triangles to represent the sphere. The second might take a bit longer to create but then is much smoother.

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard