Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / 3d to 2d relation

Author
Message
pictionaryjr
17
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 28th Oct 2011 05:04
Ok you can lock an object to the screen and send it out a certain zdistance where there are as many 3d points on screen as 2d. For example. If your screen resolution is 640x480 the sweet spot is 400 for the z value. at that position there are 640 points along the x axis in 3d space and 480 along the y just like the screen resolution. my question is how can we mathematically determine by the screen size what the distance for equal x and y points is?

Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 28th Oct 2011 10:07
would pick screen at 0,0 and screen width(),screen height() work? The math behind it is a linear algebra projection, and there's likely a simpler way.

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 28th Oct 2011 13:36
It depends on the FOV of the camera you are using. Once you know that it sould just take a bit of trig to get the answer.

[b]
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 28th Oct 2011 15:22
@pictionaryjr - It sounds like your trying to work out the screen in relation to 3D objects and coordinates. There are commands like PickScreen() which will give relative 3D coords from a 2D position, and PickObject() which will return the first objects ID under the coords given (usually the mouse coords). As Diggsey said and as I understand it, altering the FOV can upset the PickObject() function and possibly the PickScreen() function.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!

Login to post a reply

Server time is: 2026-07-11 14:37:15
Your offset time is: 2026-07-11 14:37:15