I would say that if you take the origin (0,0,0) in modelspace and apply the identity transformation (
resetMatrix()) that if would give you coordinate (0,0,0) back. But it does not:
Code:
void setup()
{
size(256,256,P3D);
}
void draw()
{
resetMatrix();
translate(-width/2,-height/2,0);
print("model (0,0,0) = (");
print(modelX(0,0,0));
print(", ");
print(modelY(0,0,0));
print(", ");
print(modelZ(0,0,0));
print(")\n\n");
box(64);
}
gives:
model (0,0,0) = (0.0, 0.0, 221.70251)Furthermore, why does the camera position influence the model coordinates?
Code:
void setup()
{
size(256,256,P3D);
noFill();
}
void draw()
{
background(0);
// camera(mouseX,mouseY,200,width/2,height/2,0,0,1,0);
pushMatrix();
translate(width/2,height/2, 0);
rotateX(QUARTER_PI);
rotateY(2*QUARTER_PI/3);
final float x = modelX(0,0,0);
final float y = modelY(0,0,0);
final float z = modelZ(0,0,0);
stroke(255);
box(64);
popMatrix();
// draw "copy"
translate(x,y,z);
stroke(255,0,0);
box(32);
}
If you uncomment the
camera(...) line you will see that the boxes don't stick together...
Whatsup?