Search in sources :

Example 1 with RectangleLineIntersector

use of com.revolsys.geometry.algorithm.RectangleLineIntersector in project com.revolsys.open by revolsys.

the class SimpleRectangleIntersector method run.

public void run(final boolean useSegInt, final boolean useSideInt) {
    final RectangleLineIntersector rectSegIntersector = new RectangleLineIntersector(this.rectEnv);
    final SimpleRectangleIntersector rectSideIntersector = new SimpleRectangleIntersector(this.rectEnv);
    for (int i = 0; i < this.pts.length; i++) {
        for (int j = 0; j < this.pts.length; j++) {
            if (i == j) {
                continue;
            }
            boolean segResult = false;
            if (useSegInt) {
                segResult = rectSegIntersector.intersects(this.pts[i], this.pts[j]);
            }
            boolean sideResult = false;
            if (useSideInt) {
                sideResult = rectSideIntersector.intersects(this.pts[i], this.pts[j]);
            }
            if (useSegInt && useSideInt) {
                if (segResult != sideResult) {
                    this.isValid = false;
                }
            }
        }
    }
}
Also used : RectangleLineIntersector(com.revolsys.geometry.algorithm.RectangleLineIntersector) Point(com.revolsys.geometry.model.Point)

Example 2 with RectangleLineIntersector

use of com.revolsys.geometry.algorithm.RectangleLineIntersector in project com.revolsys.open by revolsys.

the class SimpleRectangleIntersector method run.

public void run(final boolean useSegInt, final boolean useSideInt) {
    if (useSegInt) {
    // System.out.println("Using Segment Intersector");
    }
    if (useSideInt) {
    // System.out.println("Using Side Intersector");
    }
    // System.out.println("# pts: " + this.pts.length);
    final RectangleLineIntersector rectSegIntersector = new RectangleLineIntersector(this.rectEnv);
    final SimpleRectangleIntersector rectSideIntersector = new SimpleRectangleIntersector(this.rectEnv);
    final Stopwatch sw = new Stopwatch();
    for (int i = 0; i < this.pts.length; i++) {
        for (int j = 0; j < this.pts.length; j++) {
            if (i == j) {
                continue;
            }
            boolean segResult = false;
            if (useSegInt) {
                segResult = rectSegIntersector.intersects(this.pts[i], this.pts[j]);
            }
            boolean sideResult = false;
            if (useSideInt) {
                sideResult = rectSideIntersector.intersects(this.pts[i], this.pts[j]);
            }
            if (useSegInt && useSideInt) {
                if (segResult != sideResult) {
                    throw new IllegalStateException("Seg and Side values do not match");
                }
            }
        }
    }
// System.out.println("Finished in " + sw.getTimeString());
// System.out.println();
}
Also used : Stopwatch(com.revolsys.geometry.util.Stopwatch) RectangleLineIntersector(com.revolsys.geometry.algorithm.RectangleLineIntersector) Point(com.revolsys.geometry.model.Point)

Aggregations

RectangleLineIntersector (com.revolsys.geometry.algorithm.RectangleLineIntersector)2 Point (com.revolsys.geometry.model.Point)2 Stopwatch (com.revolsys.geometry.util.Stopwatch)1