CCRay3 extends CCLine3Base { public boolean intersectsTriangle( final CCVector3 theA, final CCVector3 theB, final CCVector3 theC, final CCVector3 theLocationStore ) { return intersects(theA, theB, theC, theLocationStore, false); } CCRay3();  CCRay3(final CCRay3 theSource);  CCRay3(final CCVector3 theOrigin, final CCVector3 theDirection); static CCRay3 createFromLine(CCVector3 theStart, CCVector3 theEnd); CCRay3 set(final CCRay3 theSource); double getDistanceToPrimitive(final CCVector3[] theWorldVertices); boolean intersects(final CCVector3[] thePolygonVertices, final CCVector3 theLocationStore); boolean intersectsTriangle(
		final CCVector3 theA, 
		final CCVector3 theB, 
		final CCVector3 theC, 
		final CCVector3 theLocationStore
	); boolean intersectsTrianglePlanar(
		final CCVector3 pointA, 
		final CCVector3 pointB, 
		final CCVector3 pointC,
		final CCVector3 locationStore
	); boolean intersectsQuad(
		final CCVector3 theA, 
		final CCVector3 theB, 
		final CCVector3 theC, 
		final CCVector3 theD,
		final CCVector3 theLocationStore
	); boolean intersectsQuadPlanar(
		final CCVector3 theA, 
		final CCVector3 theB, 
		final CCVector3 theC, 
		final CCVector3 theD,
		final CCVector3 theLocationStore
	); CCVector3 intersectsPlane(final CCPlane thePlane, CCVector3 theLocationStore); CCVector3 intersectsPlane(final CCPlane thePlane); double distanceSquared(final CCVector3 thePoint, final CCVector3 theStore); static boolean isValid(final CCRay3 theRay); @Override String toString(); @Override boolean equals(final Object theObject); @Override CCRay3 clone();  }
@Test public void testIntersectsTriangle() { final CCVector3 v0 = new CCVector3(-1, -1, -1); final CCVector3 v1 = new CCVector3(+1, -1, -1); final CCVector3 v2 = new CCVector3(+1, +1, -1); final CCVector3 intersectionPoint = new CCVector3(); CCRay3 pickRay = new CCRay3(new CCVector3(0.5f, -0.5f, 3), new CCVector3(0, 0, -1)); assertTrue(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); pickRay = new CCRay3(new CCVector3(0, -1, 3), new CCVector3(0, 0, -1)); assertTrue(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); pickRay = new CCRay3(new CCVector3(0, 0, 3), new CCVector3(0, 0, -1)); assertTrue(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); pickRay = new CCRay3(new CCVector3(+1, 0, 3), new CCVector3(0, 0, -1)); assertTrue(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); pickRay = new CCRay3(new CCVector3(-1, -1, 3), new CCVector3(0, 0, -1)); assertTrue(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); pickRay = new CCRay3(new CCVector3(+1, -1, 3), new CCVector3(0, 0, -1)); assertTrue(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); pickRay = new CCRay3(new CCVector3(1, 1, 3), new CCVector3(0, 0, -1)); assertTrue(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); pickRay = new CCRay3(new CCVector3(0f, -1.1f, 3), new CCVector3(0, 0, -1)); assertFalse(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); pickRay = new CCRay3(new CCVector3(-0.1f, 0.1f, 3), new CCVector3(0, 0, -1)); assertFalse(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); pickRay = new CCRay3(new CCVector3(+1.1f, 0, 3), new CCVector3(0, 0, -1)); assertFalse(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); pickRay = new CCRay3(new CCVector3(-0.5f, -0.5f, 3), new CCVector3(0, 0, +1)); assertFalse(pickRay.intersectsTriangle(v0, v1, v2, intersectionPoint)); pickRay = new CCRay3(new CCVector3(0.5f, -0.5f, 3), new CCVector3(0, 0, -1)); assertTrue(4.0 == pickRay.getDistanceToPrimitive(new CCVector3[] { v0, v1, v2 })); assertTrue(pickRay.intersectsTrianglePlanar(v0, v1, v2, intersectionPoint)); }