@@ -0,0 +1,2167 @@
+package org.joml.test;%0A%0Aimport junit.framework.TestCase;%0A%0Aimport org.joml.PolygonPointIntersection;%0Aimport org.joml.PolygonPointIntersection.Interval;%0A%0A/**%0A * Tests for the %7B@link PolygonPointIntersection%7D class.%0A * %0A * @author Kai Burjack%0A */%0Apublic class PolygonPointIntersectionTest extends TestCase %7B%0A%0A    public static void testSimple() %7B%0A        // Define a shape that looks like a %22U%22%0A        float%5B%5D verticesXY = %7B%0A                0, 0,%0A                3, 0,%0A                3, 1,%0A                2, 1,%0A                2, 0.5f,%0A                1, 0.5f,%0A                1, 1,%0A                0, 1%0A        %7D;%0A        PolygonPointIntersection isect = new PolygonPointIntersection(verticesXY);%0A        Interval%5B%5D working = new Interval%5Bisect.workingSize()%5D;%0A        // Left part of the %22U%22%0A        assertTrue(isect.pointInPolygon(0.1f, 0.1f, working));%0A        // top middle of the %22U%22%0A        assertFalse(isect.pointInPolygon(1.5f, 0.8f, working));%0A        // bottom middle of the %22U%22%0A        assertTrue(isect.pointInPolygon(1.5f, 0.2f, working));%0A        // right part of the %22U%22%0A        assertTrue(isect.pointInPolygon(2.5f, 0.1f, working));%0A    %7D%0A%0A    public static void testBigCircle() %7B%0A        int polyN = 1024 * 256;%0A        float%5B%5D verticesXY = new float%5BpolyN * 2%5D;%0A        for (int i = 0; i %3C polyN; i++) %7B%0A            float x = (float) Math.cos(2.0 * Math.PI * i / polyN);%0A            float y = (float) Math.sin(2.0 * Math.PI * i / polyN);%0A            verticesXY%5B2 * i + 0%5D = x;%0A            verticesXY%5B2 * i + 1%5D = y;%0A        %7D%0A        PolygonPointIntersection isect = new PolygonPointIntersection(verticesXY);%0A        Interval%5B%5D working = new Interval%5Bisect.workingSize()%5D;%0A        // Center%0A        assertTrue(isect.pointInPolygon(0, 0, working));%0A        // Left outside%0A        assertFalse(isect.pointInPolygon(-1.1f, 0, working));%0A        // Top right outside%0A        assertFalse(isect.pointInPolygon(0.8f, 0.8f, working));%0A        // Top edge%0A        assertTrue(isect.pointInPolygon(1.0f, 0, working));%0A        // Bottom edge %3C- algorithm only detects top edges as 'inside'%0A        assertFalse(isect.pointInPolygon(-1.0f, 0, working));%0A    %7D%0A%0A%7D%0A

Add PolygonPointIntersection test