/** * Uses the camera to map all points from model space, (x, y, z) to screen space (x_, y_, z_). * Remember that x_ represents the depth of the point and (y_, z_) maps to the screen (x, y) * co-ords of the point. * * @see CameraMan */ public void transform() { final float[] f = modelViewer.cameraMan.getFocus(); final float[][] m = modelViewer.cameraMan.getMatrix(); final float d = modelViewer.cameraMan.getDistance(); float[] a = new float[3]; visible = false; // set true if any points are visble to the camera for (int i = 0; i < npoints * 3; i += 3) { a[0] = ps[i] - f[0]; a[1] = ps[i + 1] - f[1]; a[2] = ps[i + 2] - f[2]; Tools3d.applyTo(m, a, a); visibles[i / 3] = Tools3d.projectYZ(a, a, d); ps_[i] = a[0]; if (visibles[i / 3]) { modelViewer.cameraMan.scaleToScreen(a); ps_[i + 1] = a[1]; ps_[i + 2] = a[2]; visible = true; } // depth bounding box if (i == 0) { x_min = x_max = ps_[i]; } else { if (ps_[i] < x_min) x_min = ps_[i]; if (ps_[i] > x_max) x_max = ps_[i]; } } }