FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   ScreenZ and objectZ ?s
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: ScreenZ and objectZ ?s  (Read 316 times)
flight404

WWW Email
ScreenZ and objectZ ?s
« on: May 10th, 2004, 8:42pm »

Why would screenZ give any number besides maybe 0 or 1.  If I understand the screenZ command correctly, it takes the position of an object in space and tells you what the z axis information would be for that object on a 2 Dimensional screen aka the monitor.  Should it even exist at all? and if so, what would be a possible use.
 
I was getting a range of numbers in the .992 -> .996 range for the project I am working on.  I tried it as an a possible solution for my actual dilema.
 
When using beginCamera and rotateX,Y, or Z, my objectZ result is not what I would desire.
 
Code:

void doCamera(){
  distance = 100.0;
  beginCamera();
  perspective(60.0f, (float)width / (float)height, 1.0f, 500);
  translate(0, 0, -distance);
  twist = radians(mouseX / 2.0f);
  elevation = radians(mouseY / 2.0f);
   
  rotateY(-twist);
  rotateX(elevation);
  rotateZ(-azimuth);
  endCamera();
}

 
When using this camera code (I think a gift from Malka... not sure), my objectZ doesn't give me what I hoped (the virtual distance from me to the object), instead giving me the distance from me to object if I apply no rotations.  
 
Am I making sense?  thoughts?
 
r
 
flight404

WWW Email
Re: ScreenZ and objectZ ?s
« Reply #1 on: May 10th, 2004, 8:45pm »

Oh crap.  After some manipulating the result of screenZ, it seems that was what I wanted after all.
 
Which leads me to my revised final question...
What would be an example of a use for screenZ and a use for objectZ?
 
r
 
arielm

WWW
Re: ScreenZ and objectZ ?s
« Reply #2 on: May 11th, 2004, 12:35am »

yep, the camera code could be a mutant offspring of this old one...
 
(concerning screenZ and its utility: we share the same un-understanding!)
 

Ariel Malka | www.chronotext.org
Pages: 1 

« Previous topic | Next topic »