Search in sources :

Example 6 with PointDouble

use of com.revolsys.geometry.model.impl.PointDouble in project com.revolsys.open by revolsys.

the class CoordinateTest method testEquals.

public void testEquals() {
    final Point c1 = new PointDouble(1.0, 2, 3);
    final String s = "Not a coordinate";
    assertTrue(!c1.equals(s));
    final Point c2 = new PointDouble(1.0, 2.0, 3.0);
    assertTrue(c1.equals(2, c2));
    final Point c3 = new PointDouble(1.0, 22.0, 3.0);
    assertTrue(!c1.equals(2, c3));
}
Also used : PointDouble(com.revolsys.geometry.model.impl.PointDouble) Point(com.revolsys.geometry.model.Point)

Example 7 with PointDouble

use of com.revolsys.geometry.model.impl.PointDouble in project com.revolsys.open by revolsys.

the class CoordinateTest method testEquals2D.

public void testEquals2D() {
    final Point c1 = new PointDouble(1.0, 2.0, 3.0);
    final Point c2 = new PointDouble(1.0, 2.0, 3.0);
    assertTrue(c1.equals(2, c2));
    final Point c3 = new PointDouble(1.0, 22.0, 3.0);
    assertTrue(!c1.equals(2, c3));
}
Also used : PointDouble(com.revolsys.geometry.model.impl.PointDouble) Point(com.revolsys.geometry.model.Point)

Example 8 with PointDouble

use of com.revolsys.geometry.model.impl.PointDouble in project com.revolsys.open by revolsys.

the class CoordinateTest method testGetOrdinate.

public void testGetOrdinate() {
    final Point c = new PointDouble(350.2, 4566.8, 5266.3);
    assertEquals(c.getCoordinate(Geometry.X), 350.2);
    assertEquals(c.getCoordinate(Geometry.Y), 4566.8);
    assertEquals(c.getCoordinate(Geometry.Z), 5266.3);
}
Also used : PointDouble(com.revolsys.geometry.model.impl.PointDouble) Point(com.revolsys.geometry.model.Point)

Example 9 with PointDouble

use of com.revolsys.geometry.model.impl.PointDouble in project com.revolsys.open by revolsys.

the class CoordinateTest method testDistance3D.

public void testDistance3D() {
    final Point coord1 = new PointDouble(0.0, 0.0, 0.0);
    final Point coord2 = new PointDouble(100.0, 200.0, 50.0);
    final double distance = coord1.distance3d(coord2);
    assertEquals(distance, 229.128784747792, 0.000001);
}
Also used : PointDouble(com.revolsys.geometry.model.impl.PointDouble) Point(com.revolsys.geometry.model.Point)

Example 10 with PointDouble

use of com.revolsys.geometry.model.impl.PointDouble in project com.revolsys.open by revolsys.

the class CoordinateTest method testDistance.

public void testDistance() {
    final Point coord1 = new PointDouble(0.0, 0.0, 0.0);
    final Point coord2 = new PointDouble(100.0, 200.0, 50.0);
    final double distance = coord1.distance(coord2);
    assertEquals(distance, 223.60679774997897, 0.00001);
}
Also used : PointDouble(com.revolsys.geometry.model.impl.PointDouble) Point(com.revolsys.geometry.model.Point)

Aggregations

PointDouble (com.revolsys.geometry.model.impl.PointDouble)24 Point (com.revolsys.geometry.model.Point)22 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)4 Test (org.junit.Test)4 BoundingBox (com.revolsys.geometry.model.BoundingBox)3 ArrayList (java.util.ArrayList)2 KdNode (com.revolsys.geometry.index.kdtree.KdNode)1 KdTree (com.revolsys.geometry.index.kdtree.KdTree)1 LineString (com.revolsys.geometry.model.LineString)1 BoundingBoxDoubleXY (com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)1 LineStringDouble (com.revolsys.geometry.model.impl.LineStringDouble)1 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)1 PointDoubleXYZ (com.revolsys.geometry.model.impl.PointDoubleXYZ)1 List (java.util.List)1