Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

share|improve this question
5  
You could make Tubes out of it? I'm afraid that you should provide the code for the isosurface and the points so one can reproduce it. –  Öskå Jun 11 at 11:00
    
Have you looked at the Opacity directive for the code that generates isosurface? –  m_goldberg Jun 11 at 12:31
    
you may use Overlay and SetAlphaChannel Overlay[{isosurface, SetAlphaChannel[ Graphics3D[{Black, PointSize[0.05], Point[geom]}, Boxed -> False], .5]}, All, 2] –  s.s.o Jun 11 at 14:00
    
    
added the code and the data –  molkee Jun 11 at 18:09

2 Answers 2

up vote 2 down vote accepted

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

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.