CCPlane implements Cloneable, Externalizable { public CCVector3 reflectVector(final CCVector3 theUnitVector, final CCVector3 theStore) { CCVector3 result = theStore; if (result == null) { result = new CCVector3(); } final double dotProd = _myNormal.dot(theUnitVector) * 2; result.set(theUnitVector).subtractLocal(_myNormal.x * dotProd, _myNormal.y * dotProd, _myNormal.z * dotProd); return result; } CCPlane();  CCPlane(final CCPlane theSource);  CCPlane(final CCVector3 theNormal, final double theConstant);  CCPlane(CCVector3 theOrigin, CCVector3 theNormal);  CCPlane(final CCVector3 theV1, final CCVector3 theV2, final CCVector3 theV3); double constant(); CCVector3 normal(); CCPlane set(final CCPlane theSource); void setConstant(final double theConstant); void setNormal(final CCVector3 theNormal); double pseudoDistance(final CCVector3 thePoint); double distance(final CCVector3 thePoint); Side whichSide(final CCVector3 thePoint); void setOriginNormal(CCVector3 theOrigin, CCVector3 theNormal); CCPlane setPlanePoints(final CCVector3 theA, final CCVector3 theB, final CCVector3 theC); CCVector3 reflectVector(final CCVector3 theUnitVector, final CCVector3 theStore); static boolean isValid(final CCPlane thePlane); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object theObject); @Override CCPlane clone(); @Override void readExternal(final ObjectInput in); @Override void writeExternal(final ObjectOutput out); static final CCPlane XZ; static final CCPlane XY; static final CCPlane YZ; }
@Test public void testReflect() { final CCPlane plane1 = new CCPlane(CCVector3.UNIT_X, 5.0f); assertEquals(new CCVector3(), plane1.reflectVector(new CCVector3(), new CCVector3())); assertEquals(new CCVector3(-1, 0, 0), plane1.reflectVector(new CCVector3(1, 0, 0), null)); assertEquals(new CCVector3(-1, 1, 1).normalizeLocal(), plane1.reflectVector(new CCVector3(1, 1, 1).normalizeLocal(), null)); assertEquals(new CCVector3(-3, 2, -1).normalizeLocal(), plane1.reflectVector(new CCVector3(3, 2, -1).normalizeLocal(), null)); final CCPlane plane2 = new CCPlane(CCVector3.UNIT_Z, 1.0f); assertEquals(new CCVector3(), plane2.reflectVector(new CCVector3(), new CCVector3())); assertEquals(new CCVector3(0, 0, -1), plane2.reflectVector(new CCVector3(0, 0, 1), null)); assertEquals(new CCVector3(1, 1, -1).normalizeLocal(), plane2.reflectVector(new CCVector3(1, 1, 1).normalizeLocal(), null)); assertEquals(new CCVector3(3, 2, 1).normalizeLocal(), plane2.reflectVector(new CCVector3(3, 2, -1).normalizeLocal(), null)); }