/** * @param polygonVertices * @param locationStore * @return true if this ray intersects a polygon described by the given vertices. */ @Override public boolean intersects(final Vector3[] polygonVertices, final Vector3 locationStore) { if (polygonVertices.length == 3) { // TRIANGLE return intersectsTriangle(polygonVertices[0], polygonVertices[1], polygonVertices[2], locationStore); } else if (polygonVertices.length == 4) { // QUAD return intersectsQuad(polygonVertices[0], polygonVertices[1], polygonVertices[2], polygonVertices[3], locationStore); } // TODO: Add support for line and point return false; }
assertTrue(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); assertTrue(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); assertTrue(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); assertTrue(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); assertTrue(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); assertTrue(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); assertTrue(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); assertFalse(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); assertFalse(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); assertFalse(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); assertFalse(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint));
/** * @param polygonVertices * @param locationStore * @return true if this ray intersects a polygon described by the given vertices. */ @Override public boolean intersects(final Vector3[] polygonVertices, final Vector3 locationStore) { if (polygonVertices.length == 3) { // TRIANGLE return intersectsTriangle(polygonVertices[0], polygonVertices[1], polygonVertices[2], locationStore); } else if (polygonVertices.length == 4) { // QUAD return intersectsQuad(polygonVertices[0], polygonVertices[1], polygonVertices[2], polygonVertices[3], locationStore); } // TODO: Add support for line and point return false; }
if (!_workRay.intersectsTriangle(_gridTriA.getA(), _gridTriA.getB(), _gridTriA.getC(), store)) { final boolean intersects = _workRay.intersectsTriangle(_gridTriB.getA(), _gridTriB.getB(), _gridTriB.getC(), store); if (intersects && normalStore != null) {
if (!_workRay.intersectsTriangle(_gridTriA.getA(), _gridTriA.getB(), _gridTriA.getC(), store)) { final boolean intersects = _workRay.intersectsTriangle(_gridTriB.getA(), _gridTriB.getB(), _gridTriB.getC(), store); if (intersects && normalStore != null) {