use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class ConvexHullTest method testAllIdenticalPoints.
public void testAllIdenticalPoints() throws Exception {
final List<Point> points = new ArrayList<>();
for (int i = 0; i < 100; i++) {
points.add(new PointDoubleXY(0.0, 0));
}
final Geometry actualGeometry = ConvexHull.convexHull(this.geometryFactory, points);
final Geometry expectedGeometry = this.geometryFactory.geometry("POINT(0 0)");
assertTrue(expectedGeometry.equals(2, actualGeometry));
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class AffineTransformationBuilderTest method run.
void run(final double p0x, final double p0y, final double p1x, final double p1y, final double p2x, final double p2y, final double pp0x, final double pp0y, final double pp1x, final double pp1y, final double pp2x, final double pp2y) {
final Point p0 = new PointDoubleXY(p0x, p0y);
final Point p1 = new PointDoubleXY(p1x, p1y);
final Point p2 = new PointDoubleXY(p2x, p2y);
final Point pp0 = new PointDoubleXY(pp0x, pp0y);
final Point pp1 = new PointDoubleXY(pp1x, pp1y);
final Point pp2 = new PointDoubleXY(pp2x, pp2y);
final AffineTransformationBuilder atb = new AffineTransformationBuilder(p0, p1, p2, pp0, pp1, pp2);
final AffineTransformation trans = atb.getTransformation();
assertEqualPoint(pp0, trans.transform(p0));
assertEqualPoint(pp1, trans.transform(p1));
assertEqualPoint(pp2, trans.transform(p2));
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class AffineTransformationBuilderTest method runSingular.
void runSingular(final double p0x, final double p0y, final double p1x, final double p1y, final double p2x, final double p2y, final double pp0x, final double pp0y, final double pp1x, final double pp1y, final double pp2x, final double pp2y) {
final Point p0 = new PointDoubleXY(p0x, p0y);
final Point p1 = new PointDoubleXY(p1x, p1y);
final Point p2 = new PointDoubleXY(p2x, p2y);
final Point pp0 = new PointDoubleXY(pp0x, pp0y);
final Point pp1 = new PointDoubleXY(pp1x, pp1y);
final Point pp2 = new PointDoubleXY(pp2x, pp2y);
final AffineTransformationBuilder atb = new AffineTransformationBuilder(p0, p1, p2, pp0, pp1, pp2);
final AffineTransformation trans = atb.getTransformation();
assertEquals(trans, null);
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class LineSegmentTest method checkOffset.
void checkOffset(final double x0, final double y0, final double x1, final double y1, final double segFrac, final double offset, final double expectedX, final double expectedY) {
final LineSegment seg = new LineSegmentDouble(2, x0, y0, x1, y1);
final Point p = seg.pointAlongOffset(segFrac, offset);
assertTrue(equalsTolerance(new PointDoubleXY(expectedX, expectedY), p, 0.000001));
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class LineSegmentTest method testProjectionFactor.
public void testProjectionFactor() {
// zero-length line
final LineSegment seg = new LineSegmentDouble(2, 10, 0, 10, 0);
assertTrue(Double.isNaN(seg.projectionFactor(new PointDoubleXY(11.0, 0))));
final LineSegment seg2 = new LineSegmentDouble(2, 10, 0, 20, 0);
assertTrue(seg2.projectionFactor(new PointDoubleXY(11.0, 0)) == 0.1);
}
Aggregations