Solved my own problem - it seems that getting the normal out from the
screen does work - here's a code fragment for anyone interested (does
this count as a bug? its certainly borderline)
public PickShape generatePickRay(int xpos, int ypos)
{
Transform3D motion=new Transform3D();
Point3d p1Posn = new Point3d();
Point3d p3Posn = new Point3d();
Point3d mousePosn = new Point3d();
Vector3d v1Vec=new Vector3d();
Vector3d v3Vec=new Vector3d();
Vector3d rayVec=new Vector3d();
canvas.getPixelLocationInImagePlate(canvas.getWidth(),0,p1Posn);
canvas.getPixelLocationInImagePlate(canvas.getWidth(),
canvas.getHeight(), p3Posn);
canvas.getPixelLocationInImagePlate(xpos,ypos,mousePosn);
canvas.getImagePlateToVworld(motion);
motion.transform(p1Posn);
motion.transform(p3Posn);
motion.transform(mousePosn);
System.out.println("p1posn : "+p1Posn+", p3posn : "+p3Posn+" mposn :
"+mousePosn);
v1Vec.sub(p1Posn, mousePosn);
v1Vec.normalize();
v3Vec.sub(p3Posn, mousePosn);
v3Vec.normalize();
rayVec.cross(v1Vec, v3Vec);
rayVec.normalize();
System.out.println(rayVec);
pickRay.set(mousePosn, rayVec);
return (PickShape) pickRay;
}
Tim Darby
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/