Hi!
I have the problem with understanding how intersectstion is done. The
following example and comments describe it.
Jure
import com.sun.j3d.utils.behaviors.picking.*;
import javax.media.j3d.*;
import javax.vecmath.*;
public class intersection {
public intersection() {
Point3d a = new Point3d(0.0, 1.0, 0.0);
Point3d b = new Point3d(1.0, 1.0, 0.0);
// with b.x = 1.0 it works fine but with b.x = 10.0
// it doesn't. In both cases, dist[0] should be 0.2, right?
// but it's 0.02 (if b.x=10.0) and 0.1 (if b.x=2.0)
// the correct result is dist[0]*b.x
Point3d a1 = new Point3d(0.2, 0.0, 0.0);
Point3d b1 = new Point3d(0.2, 2.0, 0.0);
Point3d[] l2 = {a1, b1};
Intersect u = new Intersect();
PickSegment l1 = new PickSegment(a, b);
double[] dist = new double[1];
boolean intr = u.segmentAndLine(l1, l2, 0, dist);
if(intr) System.out.println("Intersects at " + dist[0]);
else System.out.println("Does not intersect.");
}
public static void main(String[] args) {
new intersection();
} // main
} // class intersection
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/