We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexSuggestions & BugsSoftware Bugs › world space ( modelX(), modelY(), modelZ() )
Page Index Toggle Pages: 1
world space ( modelX(), modelY(), modelZ() ) (Read 1960 times)
world space ( modelX(), modelY(), modelZ() )
Jan 19th, 2007, 1:21am
 
I am using processing v123. Have modelX(),modelY(),modelZ() been changed/fixed/upgraded in any way? They do not act like they are "supposed" to act, unless I am using the functions incorrectly. Check out the following:

Code:


// written in processing v123

import processing.opengl.*;

void setup(){
size(500,500,OPENGL);
noFill();
}

float cx, cy, cz;
float x,y,z;

// rotate vars
float ryoffset = radians(random(360));
float rzoffset = radians(random(360));
float rinc = 0;

float radius = 150;

void draw(){

background(0);

cx = width/2;
cy = height/2;
cz = 0;

pushMatrix();
{
// overall translation (center point)
translate(cx,cy,cz);

// drawing the center
ellipse(0,0,5,5);

// some offset rotation
rotateY(ryoffset);
rotateZ(rzoffset);

// and actual rotation movement
rotateX(rinc);

// offset from center
translate(0,radius,0);

stroke(255,0,0);
// the object
box(20,20,20);

// get the location of this particular matrix, assign it to x,y,z
x = modelX(0,0,0);
y = modelY(0,0,0);
z = modelZ(0,0,0);
}
popMatrix();

// increment the rotation for animation
rinc+=.02;


// draw a line from the center to the worldpace of the matrix
stroke(0,255,255);
line(cx,cy,cz,x,y,z);

// and draw a shape
pushMatrix();
translate(x,y,z);
box(20,20,20);
popMatrix();
}



Ideally, the blue box should match the translation of the red box exactly. It does not. If I can't use modelX(),modelY(),modelZ() -- How can I get the worldspace of an object? In the code above, how can I get the worldspace of the red box? This may not be a bug, in which case a lesson would be appreciated. Smiley Thanks!
Re: world space ( modelX(), modelY(), modelZ() )
Reply #1 - Jan 19th, 2007, 1:50am
 
I suppose this is the bug report for this issue : http://dev.processing.org/bugs/show_bug.cgi?id=386. But I'm still not sure if it's resolved, or if it's acting correctly.
Re: world space ( modelX(), modelY(), modelZ() )
Reply #2 - Jan 19th, 2007, 3:34am
 
looks like it's not completely fixed yet, that's unfortunate. i'll re-open the bug and look into it again. wonder why it was working in some situations and not in others. i'll close this thread and we can follow up on the bugs db if you have any questions.
Re: world space ( modelX(), modelY(), modelZ() )
Reply #3 - Jan 19th, 2007, 3:37am
 
now filed here:
http://dev.processing.org/bugs/show_bug.cgi?id=486
Page Index Toggle Pages: 1