- for(int i = 0; i < points.length; i++) {
points[i].update();
points[i].display();
}
// LINES
if(drawLines) {
// save current transformation & reset camera
currCameraMatrix = new PMatrix3D(g3.camera);
camera();
noFill();
stroke(0, 0, 255);
for(int i = 0; i < points.length; i++) {
float ix = screenX(points[i].mx, points[i].my, points[i].mz);
float iy = screenY(points[i].mx, points[i].my, points[i].mz);
for(int j = 0; j < i; j++) {
float jx = screenX(points[j].mx, points[j].my, points[j].mz);
float jy = screenY(points[j].mx, points[j].my, points[j].mz);
if(dist(ix, iy, jx, jy) < 200) {
line(ix, iy, jx, jy);
}
}
}
// restore camera
g3.camera = currCameraMatrix;
}
--
Please see the simple example above. It is drawing lines between points in a environment explored via peasycam. I'm using the standard method to revert to a 2d representation of the space, but somehow the above only works when peasycam is not tweening. While rotating the scene, the point around which the lines rotate seems to be offset to the camera position. When the tween ends, and the scene has become static, everything is drawn like it should.
Why?
3