Why are my 3D plots blue?
- To: mathgroup at smc.vnet.net
- Subject: [mg114210] Why are my 3D plots blue?
- From: Joseph Gwinn <joegwinn at comcast.net>
- Date: Sat, 27 Nov 2010 03:36:43 -0500 (EST)
I've noticed an apparently harmless but mystifying oddity.
I have some Graphics3D plots that contain an object that is being moved
and rotated by a 3D mouse (a SpaceNavigator). If the view as initially
determined by Graphics3D does not change, one can move the object around
forever with no blue.
If the view is changed (either by direct mouse click-and-drag action to
rotate the bounding box, or automatically as Graphics3D computes a
better view), the entire plot window will become see-through pastel
blue, the same shade as is used to mark the bracket of a selected cell.
If one selects the cell manually before using the 3D mouse to spin the
object, the plot does not go blue.
In all cases, this is within a DynamicModule and ControllerState is
being used to obtain the datastream from the 3D mouse. There are no
messages or errors reported when the plot goes blue.
Does anyone know what's going on? Somehow, the plot is being selected.
One assumes that once the cause is understood, it will be obvious how to
prevent this annoyance.
Thanks,
Joe Gwinn
For the record, here is the code of one miscreant:
DynamicModule[{qd=Q[1,0,0,0],qxr,qyr,qzr,xr,yr,zr,xd,yd,zd,xp=0,yp=0,zp=0
},
Dynamic[{xp,yp,zp}+=3{-1,1,1}*ControllerState["SpaceNavigator",{"X","Z","
Y"}]^3;
{xr,yr,zr}=-5ControllerState["SpaceNavigator",{"X Rotation","Z
Rotation","Y Rotation"}]^3;
qxr=Q[Cos[xr/2],Sin[xr/2],0,0]; (* Generate the X-axis rotation
quaternion *)
qyr=Q[Cos[yr/2],0,Sin[yr/2],0]; (* Generate the Y-axis rotation
quaternion *)
qzr=Q[Cos[zr/2],0,0,Sin[zr/2]]; (* Generate the Z-axis rotation
quaternion *)
qd=qzr**qyr**qxr**qd; (* Apply the composite rotation to the current
direction *)
{xd,yd,zd}=SWproduct[{0,0,1},qd]; (* Sandwich product computes the
direction vector *)
Graphics3D[{Sphere[{xp,yp,zp},0.3],Arrow[Tube[{{xp,yp,zp},{xp,yp,zp}+7{xd
,yd,zd}},0.1]],Text["Log10 Abs Q Norm error=
"<>ToString[Log[10,Abs[Norm[qd]-1]]]/2,{0,0,-11.5}]
,Text[ToString[qd],{0,0,-10}] ,Text["DirVec=
"<>ToString[{xd,yd,zd}],{0,0,-13}],Text["Loc=
"<>ToString[{xp,yp,zp}],{0,0,-14.5}]}
,PlotRange->{{-10,+10},{-10,+10},{-10,+10}},PlotLabel->"Translation plus
Quaternion
rotation",ViewPoint->Front,ViewVertical->{0,0,1},ViewCenter->{0,0,0},View
Vector->{{0,25,0},{0,-1,0}},ControllerLinking->False]]]
End code. SWproduct[] uses a quaternion to rotate an ordinary vector.