MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Locator 3D

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84712] Re: Locator 3D
  • From: "Fred Klingener" <gigabitbucket at gmail.com>
  • Date: Fri, 11 Jan 2008 04:37:28 -0500 (EST)
  • References: <fi0ndv$5c5$1@smc.vnet.net> <fibg4o$5qo$1@smc.vnet.net> <fm4s9l$br6$1@smc.vnet.net>
  • Reply-to: "Fred Klingener" <gigabitbucket at gmail.com>

<m.r at inbox.ru> wrote in message news:fm4s9l$br6$1 at smc.vnet.net...
> ...
> Mouseover and Tooltip work in 3D as well:
>
> DynamicModule[{i = 0},
> Graphics3D[
>  {AbsolutePointSize[5],
>   MapIndexed[
>    Mouseover[Dynamic[i = 0; Point[#]],
>      Dynamic[
>       i = #2[[1]]; {AbsolutePointSize[10], Red, Point[#]}]] &,
>    RandomReal[{-1, 1}, {10, 3}]]},
>  Epilog -> Inset[Style[Dynamic[i], 24], ImageScaled[{.5, .95}]],
>  PlotRange -> 1]
> ]

Maxim,

That's a nifty solution that works inside a Manipulate as well.

Manipulate[
Graphics3D[{AbsolutePointSize[5],
MapIndexed[
Mouseover[Dynamic[i = 0; Point[#]],
Dynamic[i = #2[[1]]; {AbsolutePointSize[10], Red, Point[#]}]] &,
RandomReal[{-1, 1}, {10, 3}]]},
Epilog -> Inset[Style[Dynamic[i], 24], ImageScaled[{.5, .95}]],
PlotRange -> 1]
, {n, Appearance -> None}
, Initialization :> (i = 0)
]

If we substitute the node list mined from the GraphicsComplex of a graphic 
that Mathematica creates, it seems to work ok too.

Here's a surface generated by Plot3D with nodes pickable and their 
coordinates shown using a Mouseover. The GraphicsComplex is recovered with 
// InputForm, and even though there are some nifty idioms for recovering the 
node list, I've just dug out by brute force.


Manipulate[
Show[
img,
Graphics3D[{AbsolutePointSize[5]
, MapIndexed[
Mouseover[
Dynamic[i = 0; {Opacity[0], Point[#]}]
, Dynamic[i = #2[[1]]; {AbsolutePointSize[10], Red, Point[#]
, Text[ToString[NumberForm[#, {3, 2}]], #, {0, -2},
Background -> White]}]
] &, nodeList]}
]
]
, {n, Appearance -> None}
, Initialization :> (
i = 0;
fun[x_, y_] := x^2 + y^2; img = Plot3D[fun[x, y], {x, -1, 1}, {y, -1, 1}
, PlotStyle -> {FaceForm[White], EdgeForm[None]}
, Axes -> True
, AxesLabel -> {"x", "y", "z"}
, PlotPoints -> 2
, Mesh -> None
, NormalsFunction -> None
, AspectRatio -> Automatic
, ImageSize -> {400, 400}
, ViewPoint -> {1.5, -2, 5}];
gc = img // InputForm;
nodeList = gc[[1, 1, 1]];
)
]

There are still some mysteries. The nodes can't be picked if the view angle 
is too shallow, and they can't be picked at all from below.

Cheers,
Fred



  • Prev by Date: Re: Interpolation with vectors
  • Next by Date: Mathematica SIG (Washington DC and Northern Virginia)
  • Previous by thread: Re: Locator 3D
  • Next by thread: double clicking on a nb file starts a new instance of v 6.01