00001 package edu.wpi.hri.gen.policy.ref;
00002
00003 import static org.junit.Assert.*;
00004 import junit.framework.TestCase;
00005
00006 import org.junit.Test;
00007
00008 public class PointTest extends TestCase {
00009
00010 @Test
00011 public void testPoint() {
00012 Point one = new Point(1, 2, 3);
00013 assertEquals(1.0, one.getX());
00014 assertEquals(2.0, one.getY());
00015 assertEquals(3.0, one.getZ());
00016 assertEquals(0.0, one.getzRot());
00017
00018 Point two = new Point(2, 3, 4, 90);
00019 assertEquals(2.0, two.getX());
00020 assertEquals(3.0, two.getY());
00021 assertEquals(4.0, two.getZ());
00022 assertEquals(90.0, two.getzRot());
00023
00024
00025 assertEquals(Math.sqrt(3), one.fullDistance(two));
00026 assertEquals(Math.sqrt(2), one.xyDistance(two));
00027 assertEquals(Math.sqrt(2), one.xzDistance(two));
00028 assertEquals(Math.sqrt(2), one.yzDistance(two));
00029
00030
00031 assertEquals(3.0, one.fullDistanceSquared(two));
00032 assertEquals(2.0, one.xyDistanceSquared(two));
00033 assertEquals(2.0, one.xzDistanceSquared(two));
00034 assertEquals(2.0, one.yzDistanceSquared(two));
00035 }
00036 }