/** * Main program for tests * * @param args */ public static void main(String[] args) { Mesh3D box = Mesh3D.box(10, 20, 60); Line3D lineX = box.getLineX(); Line3D lineY = box.getLineY(); Line3D lineZ = box.getLineZ(); lineX.show(); lineY.show(); lineZ.show(); box.translateXYZ(100, 0.0, 0.0); box.show(); Line3D line = new Line3D(); List<Point3D> intersects = new ArrayList<Point3D>(); for (int p = 0; p < 100; p++) { double r = 600; double theta = Math.toRadians(90.0); // Math.toRadians(Math.random()*180.0); double phi = Math.toRadians(Math.random() * 360.0 - 180.0); line.set( 0.0, 0.0, 0.0, Math.sin(theta) * Math.cos(phi) * r, Math.sin(theta) * Math.sin(phi) * r, Math.cos(theta) * r); intersects.clear(); box.intersectionRay(line, intersects); System.out.println( "theta/phi = " + Math.toDegrees(theta) + " " + Math.toDegrees(phi) + " intersects = " + intersects.size()); } }