use of com.revolsys.geometry.algorithm.RobustLineIntersector in project com.revolsys.open by revolsys.
the class LineIntersectorBenchmark method run.
@Override
public void run() {
exercise(new NonRobustLineIntersector());
exercise(new RobustLineIntersector());
}
use of com.revolsys.geometry.algorithm.RobustLineIntersector in project com.revolsys.open by revolsys.
the class CGAlgorithmFunctions method segmentIntersects.
public static boolean segmentIntersects(final Geometry g1, final Geometry g2) {
final Point[] pt1 = CoordinatesListUtil.getPointArray(g1);
final Point[] pt2 = CoordinatesListUtil.getPointArray(g2);
final RobustLineIntersector ri = new RobustLineIntersector();
ri.computeIntersectionPoints(pt1[0], pt1[1], pt2[0], pt2[1]);
return ri.hasIntersection();
}
use of com.revolsys.geometry.algorithm.RobustLineIntersector in project com.revolsys.open by revolsys.
the class NodingFunctions method MCIndexNodingWithPrecision.
public static Geometry MCIndexNodingWithPrecision(final Geometry geom, final double scaleFactor) {
final List segs = newNodedSegmentStrings(geom);
final LineIntersector li = new RobustLineIntersector(scaleFactor);
final Noder noder = new MCIndexNoder(new IntersectionAdder(li));
noder.computeNodes(segs);
final Collection nodedSegStrings = noder.getNodedSubstrings();
return fromSegmentStrings(nodedSegStrings);
}
use of com.revolsys.geometry.algorithm.RobustLineIntersector in project com.revolsys.open by revolsys.
the class RobustLineIntersectorTest method testCollinear4.
public void testCollinear4() {
final RobustLineIntersector i = new RobustLineIntersector();
final Point p1 = new PointDoubleXY(30, 10);
final Point p2 = new PointDoubleXY(20, 10);
final Point q1 = new PointDoubleXY(10, 10);
final Point q2 = new PointDoubleXY(30, 10);
i.computeIntersectionPoints(p1, p2, q1, q2);
assertEquals(LineIntersector.COLLINEAR_INTERSECTION, i.getIntersectionCount());
assertTrue(i.hasIntersection());
}
use of com.revolsys.geometry.algorithm.RobustLineIntersector in project com.revolsys.open by revolsys.
the class RobustLineIntersectorTest method test2Lines.
// public RobustLineIntersectorTest(String Name_)
public void test2Lines() {
final RobustLineIntersector i = new RobustLineIntersector();
final Point p1 = new PointDoubleXY(10, 10);
final Point p2 = new PointDoubleXY(20, 20);
final Point q1 = new PointDoubleXY(20, 10);
final Point q2 = new PointDoubleXY(10, 20);
final Point x = new PointDoubleXY(15, 15);
i.computeIntersectionPoints(p1, p2, q1, q2);
assertEquals(LineIntersector.POINT_INTERSECTION, i.getIntersectionCount());
assertEquals(1, i.getIntersectionCount());
assertEquals(x, i.getIntersection(0));
assertTrue(i.isProper());
assertTrue(i.hasIntersection());
}
Aggregations