Java Reference
In-Depth Information
PickIntersection pi = pickResult.getClosestIntersection(eyePos);
trans = (TransformGroup)
pickResult.getNode(PickResult.TRANSFORM_GROUP);
Point3d []ptw = pi.getPrimitiveCoordinatesVW(); //reflect global coordinates
Point3d []pt = pi.getPrimitiveCoordinates();
//reflect local coordinates
if (pt.length==3) //Focus on knob
{
if (pt[0].z>KNOBFACE&&pt[1].z>KNOBFACE&&pt[2].z>KNOBFACE)
{
Point3d intPt = pi.getPointCoordinatesVW();
// position of cursor
CurrentPt = new Point3f(intPt);
setPosition(sphTrans, CurrentPt);
Point3f CenterPt = new Point3f(ptw[0]);
obj = whichObject(CenterPt.x, CenterPt.y);
}
else // Focus on the other faces instead of the front face
{
setPosition(sphTrans, sphposi);
trans = null;
obj = 0;
}
}
else
{
if (pt[0].z>BUTTONFACE&&pt[1].z>BUTTONFACE&&pt[2].z>BUTTONFACE&&pt[3].z>BUTTONFACE)
{
Point3d intPt = pi.getPointCoordinatesVW();
CurrentPt = new Point3f(intPt);
setPosition(sphTrans, CurrentPt);
if (pt[0].x>=0&&pt[1].x>=0&&pt[2].x>=0&&pt[3].x>=0) // Focus on connector
{
Point3f CenterPt = new Point3f((float)((ptw[2].x+ptw[3].x)/2.0f), (float)((ptw[2].y+ptw[3].y)/2.0f), (float)(ptw[0].
z));
obj = whichObject(CenterPt.x, CenterPt.y);
}
else
// Focus on button or slider
{
Point3f CenterPt = new Point3f((float)((ptw[0].x+ptw[2].x)/2.0f), (float)((ptw[0].y+ptw[2].y)/2.0f), (float)(ptw[0].
z));
obj = whichObject(CenterPt.x, CenterPt.y);
}
}
else // Focus on the other faces instead of the front face
{
setPosition(sphTrans, sphposi);
trans = null;
obj = 0;
}
}
}
else // On picked object
Search WWH ::




Custom Search