translate example a bit confusing
in
Programming Questions
•
11 months ago
trying to understand what is going on this sketch from a book I am reading, a bit confused. The processing documentation says that translate cascades down to all elements after so lines 9 and 12 cancel themselves out? I understand that the transform X is only on X axis and does 180 which essentially flips it upside down and that shouldn't affect the Z since its just forward and back. so why even have line 12?
book says this is to center the camera around the point cloud. however this is very confusing as to how this works.
- void draw() {
- strokeWeight(8);
- //println(frameRate);
- background(0);
- kinect.update();
- PImage rgbImage = kinect.rgbImage();
- //pushMatrix();
- translate(width/2, height/2, -1000);
- rotateX(radians(180));
- translate(0, 0, 1000);
- rotateY(radians(map(mouseX, 0, width, -180, 180)));
- stroke(255);
- PVector[] depthPoints = kinect.depthMapRealWorld();
- for (int i = 0; i < depthPoints.length; i+=10) {
- PVector currentPoint = depthPoints[i];
- point(currentPoint.x, currentPoint.y, currentPoint.z);
- }
- translate(boxCenter.x, boxCenter.y, boxCenter.z);
- stroke(255, 0, 0);
- noFill();
- box(boxSize);
- //popMatrix();
- }
1