project on axes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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