/**
 * Class written for testing hw04, CS409, Spring 2000.
 * @author Paul Chew for cs409
 * 
 * To use this program, you must first download it and then add it to the
 * project that you are using for HW04.  You must then modify you Project
 * Properties to make HW04Test be the class that is being run.  See the
 * page on Using Microsoft J++ (accessible from the CS409 web pages) to get 
 * more details on this process.
 */
public class HW04Test {

	/**
	 * Main program (used for testing).
	 */
	public static void main (String[] args) {
		
		System.out.println("Test Program for HW04");
		System.out.println();
		
		// Overlapping intervals
		Rectangle ra = new Rectangle(new int[] {0}, new int[] {10});
		Rectangle rb = new Rectangle(new int[] {5}, new int[] {15});
		System.out.println("First Rectangle: " + ra);
		System.out.println("Second Rectangle: " + rb);
		System.out.println("Intersection: " + ra.intersect(rb));
		
		// Simple 1D containment
		System.out.println(rb + " contains 9: " + rb.contains(new int[] {9}));
		System.out.println(rb + " contains 1: " + rb.contains(new int[] {1}));
		System.out.println();
		
		// One interval within the other
		ra = new Rectangle(new int[] {0}, new int[] {20});
		rb = new Rectangle(new int[] {5}, new int[] {15});
		System.out.println("First Rectangle: " + ra);
		System.out.println("Second Rectangle: " + rb);
		System.out.println("Intersection: " + ra.intersect(rb));
		System.out.println();
		
		// Nonintersecting intervals
		ra = new Rectangle(new int[] {0}, new int[] {5});
		rb = new Rectangle(new int[] {10}, new int[] {15});
		System.out.println("First Rectangle: " + ra);
		System.out.println("Second Rectangle: " + rb);
		System.out.println("Intersection: " + ra.intersect(rb));
		System.out.println();
		
		// Intersecting cubes with some negative coordinates
		ra = new Rectangle(new int[] {-2,-2,-2}, new int[] {2,2,2});
		rb = new Rectangle(new int[] {-1,-1,-1}, new int[] {3,3,3});
		System.out.println("First Rectangle: " + ra);
		System.out.println("Second Rectangle: " + rb);
		System.out.println("Intersection: " + ra.intersect(rb));
		
		// Simple 3D containment (note: points on boundary are contained)
		System.out.println(rb + " contains (1,2,3): " + rb.contains(new int[] {1,2,3}));
		System.out.println(rb + " contains (2,2,2): " + rb.contains(new int[] {2,2,2}));
		System.out.println(rb + " contains (3,3,3): " + rb.contains(new int[] {3,3,3}));
		System.out.println(rb + " contains (4,2,3): " + rb.contains(new int[] {4,2,3}));
		System.out.println(rb + " contains (4,5,6): " + rb.contains(new int[] {4,5,6}));
		System.out.println();
		
		// Nonintersecting cubes with some negative coordinates
		ra = new Rectangle(new int[] {0,0,0}, new int[] {1,1,1});
		rb = new Rectangle(new int[] {-2,-2,-2}, new int[] {-1,-1,-1});
		System.out.println("First Rectangle: " + ra);
		System.out.println("Second Rectangle: " + rb);
		System.out.println("Intersection: " + ra.intersect(rb));
		System.out.println();
		
		// Barely intersecting 4D bricks
		ra = new Rectangle(new int[] {0,0,0,1}, new int[] {1,1,1,2});
		rb = new Rectangle(new int[] {1,1,1,1}, new int[] {2,2,2,2});
		System.out.println("First Rectangle: " + ra);
		System.out.println("Second Rectangle: " + rb);
		System.out.println("Intersection: " + ra.intersect(rb));
		System.out.println();
	}
}