// projectionM.apply(modelView);
//Ergebnis invertieren
// PMatrix inv = projectionM.invert();
PMatrix3D modelView = new PMatrix3D(applet.g.getMatrix());
PMatrix3D projectionM = new PMatrix3D(((PGraphics3D)applet.g).projection);
projectionM.apply(modelView);
projectionM.invert();
float[] result = new float[4];
float[] factor = new float[]{ ((2 * testpoint.getX()) / applet.width) -1,
((2 * testpoint.getY()) / applet.height) -1, //screenH - y?
(2 * testpoint.getZ()) -1 ,
1,};
//Matrix mit Vector multiplizieren
projectionM.mult(factor, result);
//System.out.println("\nResult2: ");
for (int i = 0; i < result.length; i++) {
//W auf 1 machen!?
result[i] /= result[result.length-1]; //normalize so w(4th coord) is 1