See how "Intersect" works looking for the example IntersectTest.java into the PickingTest directory (see the demo directory generated by the Java3d 1.2 setup program). By, Mauro. ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, May 29, 2000 1:30 PM Subject: Re: [JAVA3D] PickRay and point of intersection I had a similar problem, and used the same method you have below. The algorithm is correct if you assume the intersect distance is placed in dist[0], however this may not be the case. The documentation on Intersect doesn't define what dist[0] does(why is it an array?), or what value is placed back in it if an intersect returns true. The value of dist[0] is changed, but I have not been able to make sense out of the values placed in it. In my case I had to write my own ray-triangle intersector to get results I could trust. Yu Kui Zhou wrote: > Given Intersect.rayAndTriangle(myRay, coords, 3, dist)) = true, > I wnat to find the point of intersection - interPoint. I tried > the following code to do the job > > file://dist[0]-the distance between the origin of the > file://myRay and the point of intersection. > > Point3d interPoint = new Point3d(); > Vector3d di = new Vector3d(); > myRay.get(interPoint, di);//(origin,direction vector) > di.normalize();//normalising the direction vector > di.scale(dist[0]); file://di = dist[0]*di > interPoint.add(di);//interPoint=di+interPoint > > The result derived however was wrong. I really have no idea why > is that. I appreciate if you can help. > > Zhou > > Email: [EMAIL PROTECTED] > fax +61-2-6249 0506 > > =========================================================================== > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff JAVA3D-INTEREST". For general help, send email to > [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
I had a similar problem, and used the same method you have below. The algorithm is correct if you assume the intersect distance is placed in dist[0], however this may not be the case. The documentation on Intersect doesn't define what dist[0] does(why is it an array?), or what value is placed back in it if an intersect returns true. The value of dist[0] is changed, but I have not been able to make sense out of the values placed in it. In my case I had to write my own ray-triangle intersector to get results I could trust. Yu Kui Zhou wrote: > Given Intersect.rayAndTriangle(myRay, coords, 3, dist)) = true, > I wnat to find the point of intersection - interPoint. I tried > the following code to do the job > > //dist[0]-the distance between the origin of the > //myRay and the point of intersection. > > Point3d interPoint = new Point3d(); > Vector3d di = new Vector3d(); > myRay.get(interPoint, di);//(origin,direction vector) > di.normalize();//normalising the direction vector > di.scale(dist[0]); //di = dist[0]*di > interPoint.add(di);//interPoint=di+interPoint > > The result derived however was wrong. I really have no idea why > is that. I appreciate if you can help. > > Zhou > > Email: [EMAIL PROTECTED] > fax +61-2-6249 0506 > > =========================================================================== > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff JAVA3D-INTEREST". For general help, send email to > [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
