9
$\begingroup$

I'm attempting to indicate that there is a point-source of light at some position in a Graphics3D-generated image. Is there any built-in tool to do this? My patch-work solution thus far has been to imagine a sphere of radius $r$ centered at that point, and to generate a large set of diameter-length chords inside of the sphere. Surely there must be a better way that doesn't involve creating so many line or cylinder primitives?

$\endgroup$
6
$\begingroup$

Not very pretty, but:

Graphics3D[{
  Gray,
  Specularity[3, 5],
  Sphere[],
  Cuboid[{-10, -10, -2}, {10, 10, -1}],

  { (* light *)
   White,
   EdgeForm[None],
   Glow[Yellow],
   Opacity[0.5],
   Scale[
    Translate[
     PolyhedronData["GreatStellatedDodecahedron", "Faces"], 
     {2, 2, 10}],
    3]
   }
  },
 Lighting -> {{"Point", Yellow, {2, 2, 10}},
   {"Directional", White, {0, 0, 20}}},
 Boxed -> False,
 Background -> Gray
 ]

scene

$\endgroup$
  • $\begingroup$ I like it! Is there an easy way for me to generate these polytope's at a list of 3D coordinates? $\endgroup$ – user7231 May 2 '13 at 12:21
  • 1
    $\begingroup$ @user, try PolyhedronData["GreatStellatedDodecahedron", "VertexCoordinates"]. See the docs for more details. $\endgroup$ – J. M. will be back soon May 2 '13 at 12:29
  • $\begingroup$ @J.M. That doesn't quite seem to work? Can I do something like: Graphics3D[{Table[Translate[PolyhedronData["Icosahedron"],CoordinateList[[i]]], {i, 1, Length[CoordinateList]}]}]? $\endgroup$ – user7231 May 2 '13 at 12:35
  • $\begingroup$ @user, then I don't understand what you want. You ask for something that generates coordinates, I showed you a command that generates a pile of coordinates, and now you want a picture. What now? $\endgroup$ – J. M. will be back soon May 2 '13 at 12:51
  • $\begingroup$ @J.M. Sorry, I think I'm not being very clear on my end. I meant, I'd like to position some number $N$ of these polytopes in 3-space at coordinates I specify with a list. I think you thought I was asking for the coordinates of the polytope vertices. Sorry about that. $\endgroup$ – user7231 May 2 '13 at 12:57
16
$\begingroup$

Maybe using some Lines to simulate a flare star:

flarerays = Normalize /@ RandomVariate[NormalDistribution[], {500, 3}];

Graphics3D[{
  White, Specularity[.1, 10], Sphere[],
  Opacity[.1],
  Orange,
  Line[{{1, 1, 2}, {1, 1, 2} + 10 #}] & /@ flarerays,
  Blue,
  Line[{{-1, 1, -1}, {-1, 1, -1} + 10 #}] & /@ flarerays
  },
 Lighting -> {
   {"Point", Orange, {1, 1, 2}},
   {"Point", Blue, {-1, 1, -1}}
   },
 PlotRange -> {{-2, 2}, {-2, 2}, {-2, 3}},
 Background -> Black]

flare stars

$\endgroup$
  • $\begingroup$ Pretty! So a +1 ... $\endgroup$ – cormullion May 2 '13 at 21:46
  • $\begingroup$ @cormullion Thanks :) I used similar flaring thing as splash screen picture for some of my packages :) $\endgroup$ – Silvia May 2 '13 at 21:51
  • $\begingroup$ Might be cheaper to use flarerays = Normalize /@ RandomVariate[NormalDistribution[], {500, 3}] $\endgroup$ – J. M. will be back soon May 3 '13 at 0:20
  • $\begingroup$ @J.M. Yes indeed! Have added to the code. Thanks :) $\endgroup$ – Silvia May 3 '13 at 5:05
  • $\begingroup$ nice+1 2, so space ! $\endgroup$ – HyperGroups Mar 15 '14 at 16:08
8
$\begingroup$

Also not very pretty:

lights = {{"Point", Green, {5, 0, 0}}, {"Point", Red, {0, -5, 0}}};
indicators = Text[Style["*", 50, Bold, #2], #3] & @@@ lights;

Graphics3D[{Sphere[{0, 0, 0}, 3], indicators}, Lighting -> lights]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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