0

I am trying to combine two graphics objects using Show.

The first one is an isosurface:

data = Import["/PATH/furan-ks.sdat", "Table"];
ALEE = Nearest[data[[All, {1, 2, 3}]] -> Rescale[data[[All, 4]]]];
cfALEE = ColorData["Rainbow"]@First@ALEE[{#1, #2, #3}] &;
isosurface=ListSurfacePlot3D[data[[All, {1, 2, 3}]], BoxRatios -> Automatic, 
ColorFunction -> cfALEE, ColorFunctionScaling -> False, 
Boxed -> False, Axes -> False, Mesh -> None, MaxPlotPoints -> 25, 
ImageSize -> 500]

isosurface

The second one is a sequence of points:

 geom = Import["/PATH/furan.geom", "Table"];
 AngToAu = 1.88971616463;
 Function[x, x*AngToAu];
 geom = Map[%, geom, {2}];
 Show[Graphics3D[{Black, PointSize[0.05], Point[geom]}, Boxed -> False]]

points

I want the points to appear on the same plot as the surface and be plotted at the appropriate scale. A command I am using:

Show[isosurface, Graphics3D[{Black, PointSize[0.05], Point[geom]}, Boxed -> False]]

The catch is that the points effectively appear inside the surface and are NOT visible. I need to somehow project them on the surface or make them visible through the surface.

How do I deal with this? Any suggestions?

EDIT: attached the files isosurface geom

molkee
  • 899
  • 1
  • 9
  • 15

2 Answers2

2

Here is what I would propose:

AngToAu = 1.88971616463;
geom = AngToAu*Import["~/Downloads/furan.geom", "Table"];
pts = Show[
   Graphics3D[{Black, PointSize[0.05], Point[geom]}, Boxed -> False]];

data = Import["~/Downloads/furan-ks.sdat", "Table"];
ALEE = Nearest[data[[All, {1, 2, 3}]] -> Rescale[data[[All, 4]]]];
cfALEE = ColorData["Rainbow"]@First@ALEE[{#1, #2, #3}] &;
data = data[[All, {1, 2, 3}]];
isosurface = 
  ListSurfacePlot3D[data, BoxRatios -> Automatic, Boxed -> False, 
    Axes -> False, Mesh -> None, MaxPlotPoints -> 25, ImageSize -> 250, 
    RegionFunction -> Function[{x, y, z}, 
      And @@ (Norm[{y - #[[2]], z - #[[3]]}] >= .4 & /@ geom)], 
    PlotStyle -> Opacity@.5]

Producing your shell with holes as a projection of geom thanks to RegionFunction:

Then, you can either add your points:

Show[pts, isosurface]

Mathematica graphics

or create Tubes out of them:

points = Cases[Normal[isosurface], Line[x__] :> x, \[Infinity]];
centers = Mean /@ (Select[#, First@# > 0 &] & /@ points /. {{} -> Sequence[]});
coorTube = {# - {First@#2, 0, 0}, # + {First@#2, 0, 0}} & @@@ 
  Thread@{SortBy[geom, Last], SortBy[centers, Last]};
Show[
  Graphics3D[{White, Opacity@.5, Tube[#, 0.4] & /@ coorTube}, Boxed -> False],
  pts, isosurface]

Mathematica graphics

Öskå
  • 8,587
  • 4
  • 30
  • 49
1

Quick and dirty, rasterize the 3d and overlay a 2d graphic:

     Show[{Rasterize[ 
           Show[ExampleData[{"Geometry3D", "Torus"}], ViewPoint -> {0, 0, 1}] ,
                ImageSize -> {400, 400}], Graphics[Disk[125 {Sin[2 # Pi/6],
                     Cos[2 # Pi/6]} + {200, 200}, 20] & /@ Range[6]]}]

enter image description here

george2079
  • 38,913
  • 1
  • 43
  • 110