Fix each test and added READMEs
This commit is contained in:
@@ -32,7 +32,7 @@ public class Plane {
|
||||
|
||||
if ( !set ) {
|
||||
distance = r.getZ();
|
||||
|
||||
|
||||
set = true;
|
||||
} else if ( Math.abs( r.getZ() - distance ) > 1e-7 ) {
|
||||
throw new IllegalStateException( "Bad point in facet!" );
|
||||
@@ -66,7 +66,7 @@ public class Plane {
|
||||
}
|
||||
|
||||
public boolean matches( Vector3d normal, Vector3d point ) {
|
||||
return Math.abs( this.normal.dot( normal ) ) > 0.99 && Math.abs( new Vector3d( this.point ).subtract( point ).dot( normal ) ) < 0.01;
|
||||
return Math.abs( this.normal.dot( normal ) ) > 0.999 && Math.abs( new Vector3d( this.point ).subtract( point ).dot( normal ) ) < 0.00001;
|
||||
}
|
||||
|
||||
private Matrix3d getProjectionMatrix() {
|
||||
|
||||
@@ -131,6 +131,24 @@ public class Vector3d {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Vector3d other = (Vector3d) obj;
|
||||
if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(y) != Double.doubleToLongBits(other.y))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(z) != Double.doubleToLongBits(other.z))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Vector3d{x=" + x + ",y=" + y + ",z=" + z + "}";
|
||||
|
||||
Reference in New Issue
Block a user