WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-20-2010, 05:59 AM
malte malte is offline
Member
 
Join Date: Feb 2008
Posts: 7
worldToScreen??

Hi,
I do have a couple of questions regarding the worldToScreen and the worldtoscreen functions.

1. What exactly is the difference between these two? I assume they are essentially doing the same thing?

2. More importantly, I need to know the exact screen coordinates of objects in the world. worldtoscreen seems to work fine, at least until the object is not on the screen anymore but somewhere to the side or even behind the virtual camera. What exactly does the worldtoscreen function in these situations?

Thanks for any feedback,
malte
Reply With Quote
  #2  
Old 07-20-2010, 05:54 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
1) There is no difference in functionality. The worldtoscreen version will be removed in future versions, so you should use the viz.MainWindow.worldToScreen method.

2) The function returns a list of 3 values, [x,y,distance]. If distance is negative, then the point is behind the camera. If either of the x or y values is outside the normalized 0 to 1 range, then the point is not within the current view frustum.
Reply With Quote
  #3  
Old 07-21-2010, 12:58 AM
malte malte is offline
Member
 
Join Date: Feb 2008
Posts: 7
Thanks for the quick reply.

That is pretty much what I expected.

I was confused because I did in some cases get negative values for distance (when object is behind the virtual camera) but values between 0 and 1 for both screen coordinates as if the object was within the viewing frustum.

Should I just ignore all situations in which either the distance is negative or any of the two screen-coordinates is not within the range of 0-1?

Thanks again,
malte
Reply With Quote
  #4  
Old 07-21-2010, 09:32 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
If you only care about whether the object is on screen, then you should ignore all cases where the distance is negative.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:03 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC