package com.github.davidmoten.rtree.geometry;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import com.github.davidmoten.rtree.geometry.Geometries;
import com.github.davidmoten.rtree.geometry.Point;
import com.github.davidmoten.rtree.geometry.Rectangle;

public class PointTest {

	private static final double PRECISION = 0.000001;

	@Test
	public void testCoordinates() {
		Point point = Geometries.point(1, 2);
		assertEquals(1, point.x(), PRECISION);
		assertEquals(2, point.y(), PRECISION);
	}

	@Test
	public void testDistance() {
		Point p1 = Geometries.point(1, 2);
		Rectangle r = Geometries.rectangle(4, 6, 4, 6);
		assertEquals(5, p1.distance(r), PRECISION);
	}

	@Test
	public void testMbr() {
		Point p = Geometries.point(1, 2);
		Rectangle r = Geometries.rectangle(1, 2, 1, 2);
		assertEquals(r, p.mbr());
	}
}

@@ -85,24 +85,30 @@
 Equals;%0A
-%0A
 import 
+static 
 org.juni
@@ -113,175 +113,93 @@
 nit.
-Test;%0A%0Aimport com.github.davidmoten.rtree.geometry.Geometries;%0Aimport com.github.davidmoten.rtree.geometry.Point;%0Aimport com.github.davidmoten.rtree.geometry.Rectangle
+Assert.assertFalse;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport org.junit.Test
 ;%0A%0Ap
@@ -763,11 +763,324 @@
 r());%0A%09%7D
+%0A%0A%09@Test%0A%09public void testPointIntersectsItself() %7B%0A%09%09Point p = Geometries.point(1, 2);%0A%09%09assertTrue(p.intersects(p.mbr()));%0A%09%7D%0A%0A%09@Test%0A%09public void testIntersectIsFalseWhenPointsDiffer() %7B%0A%09%09Point p1 = Geometries.point(1, 2);%0A%09%09Point p2 = Geometries.point(1, 2.000001);%0A%09%09assertFalse(p1.intersects(p2.mbr()));%0A%09%7D
 %0A%7D%0A

add tests