renanse said:
No, it is correct as it is. The constant is defined as being equal to the plane normal DOT any point on the plane. Therefore if we subtract it from "normal DOT some point in space" we get a positive result if the point is in front of the plane and a negative result if it is behind the plane.
If I define a plane paralel with XY plane, and two points before and behind it, whichSide function should return different values.
The version as it is in the present lib, for me the result is 1 and 1, same values.
If I change the code like I said, the result will be right.
Please try the following code:
public static void main(String[] args) throws Exception
{
Vector3f t1 = new Vector3f( 0,0,2 );
Vector3f t2 = new Vector3f( 1,0,2 );
Vector3f t3 = new Vector3f( 1,1,2 );
Plane p1 = new Plane();
p1.setPlanePoints( t1,t2,t3 );
Vector3f point1 = new Vector3f( 0,0,1 );
Vector3f point2 = new Vector3f( 0,0,3 );
System.out.println( "p1,1:" + p1.whichSide( point1 ) );
System.out.println( "p1,2:" + p1.whichSide( point2 ) );
}