Plane { public int onSameSide(Vec3 pointA, Vec3 pointB) { if (pointA == null || pointB == null) { throw new IllegalArgumentException(Logger.logMessage(Logger.ERROR, "Plane", "onSameSide", "missingPoint")); } double da = this.distanceToPoint(pointA); double db = this.distanceToPoint(pointB); if (da < 0 && db < 0) return -1; if (da > 0 && db > 0) return 1; return 0; } Plane();  Plane(double x, double y, double z, double distance);  Plane(Plane plane); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); double distanceToPoint(Vec3 point); Plane set(double x, double y, double z, double distance); Plane set(Plane plane); Plane transformByMatrix(Matrix4 matrix); double dot(Vec3 vector); boolean intersectsSegment(Vec3 endPoint1, Vec3 endPoint2); int onSameSide(Vec3 pointA, Vec3 pointB); Vec3[] clip(Vec3 pointA, Vec3 pointB);  }
@Test public void testOnSameSide() throws Exception { Plane p = new Plane(0, 0, -1, 0); int result; result = p.onSameSide(new Vec3(1, 2, -1), new Vec3(3, 4, -1)); assertEquals("Different points on positive side of the plane (with respect to normal vector)", 1, result); result = p.onSameSide(new Vec3(1, 2, 1), new Vec3(3, 4, 1)); assertEquals("Different points on negative side of the plane (with respect to normal vector)", -1, result); result = p.onSameSide(new Vec3(1, 2, 0), new Vec3(3, 4, -1)); assertEquals("One point located on the plane, the other on the positive side the plane", 0, result); result = p.onSameSide(new Vec3(1, 2, 0), new Vec3(3, 4, 1)); assertEquals("One point located on the plane, the other on the negative side the plane", 0, result); result = p.onSameSide(new Vec3(1, 0, 0), new Vec3(1, 0, 0)); assertEquals("Coincident points, located on the plane", 0, result); result = p.onSameSide(new Vec3(1, 2, 0), new Vec3(3, 4, 0)); assertEquals("Different points located on the plane", 0, result); result = p.onSameSide(new Vec3(1, 2, 1), new Vec3(3, 4, -1)); assertEquals("Different points on opposite sides of the plane", 0, result); }