CCPlane implements Cloneable, Externalizable { public double distance(final CCVector3 thePoint){ return CCMath.abs(pseudoDistance(thePoint)); } 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 testDistance() { final CCPlane plane1 = new CCPlane(CCVector3.UNIT_Y, 1.0f); final CCVector3 point = new CCVector3(0, 5, 0); assertTrue(4.0 == plane1.pseudoDistance(point)); assertEquals(Side.Outside, plane1.whichSide(point)); point.set(0, -4, 0); assertTrue(-5.0 == plane1.pseudoDistance(point)); assertEquals(Side.Inside, plane1.whichSide(point)); point.set(1, 1, 1); assertTrue(0.0 == plane1.pseudoDistance(point)); assertEquals(Side.Neither, plane1.whichSide(point)); }