project on axes
public static Projection project( Vector3d[] vertices, Vector3d axis ) { | |
double min = axis.dot( vertices[ 0 ] ); | |
double max = min; | |
for (int i = 1; i < vertices.length; i++) { | |
// NOTE: the axis must be normalized to get accurate projections | |
double p = axis.dot( vertices[ i ] ); | |
if ( p < min ) { | |
min = p; | |
} else if ( p > max ) { | |
max = p; | |
} | |
} | |
Projection proj = new Projection( min, max ); | |
return proj; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment