Hey, thanks for making this open source. I'm trying to build an AR application as well, and learning from this is indispensable. It would have been a boon if commenting was added as well. Would you be able to take time out for it?
private boolean isMVPMatrixHitMotionEvent(float[] ModelViewProjectionMatrix, MotionEvent event){
if(event == null){
return false;
}
Matrix.multiplyMV(vertexResult, 0, ModelViewProjectionMatrix, 0, centerVertexOfCube, 0);
// circle hit test
float radius = (viewWidth / 2) * (cubeHitAreaRadius/vertexResult[3]);
float dx = event.getX() - (viewWidth / 2) * (1 + vertexResult[0]/vertexResult[3]);
float dy = event.getY() - (viewHeight / 2) * (1 - vertexResult[1]/vertexResult[3]);
double distance = Math.sqrt(dx * dx + dy * dy);
// // for debug
// overlayViewForTest.setPoint("cubeCenter", screenX, screenY);
// overlayViewForTest.postInvalidate();
return distance < radius;
}
I understand why is it being used. I don't understand the math calculations behind it - the how. Could you help please?