Fix each test and added READMEs

This commit is contained in:
2026-03-15 18:56:59 -04:00
parent c2aa41fe58
commit 14b1647c47
14 changed files with 171 additions and 22 deletions

View File

@@ -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() {

View File

@@ -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 + "}";