Thank you always, Pablo. I am trying to drag and drop objects in a scene with mouse movements. Given mouse coordinates (x,y), a picked object would be translated into mapped world coordinates from the mouse coordinates. For example, I want kind of gluunproject function in OpenGL. If every screen pixels couldn't map into world coordinates, is possible to map the nearest? Z axis is constant in my application, and not changed. for example, i need to simply translate mouse(x,y) -> world(x',y',0). is it possible?
On Sun, Jul 6, 2008 at 12:07 PM, Pablo Carneiro Elias <[EMAIL PROTECTED]> wrote: > > complementing thetha is azimuth and zenith is the other angle... > > > On Sun, Jul 6, 2008 at 1:05 PM, Pablo Carneiro Elias <[EMAIL PROTECTED]> > wrote: >> >> Jung, >> the mapping from world to screen is always possible within the camera's >> frustum, but the inverse is not true. It means that not every pixel of the >> screen has a map into world coordinates. Even if a point within the screen >> coordinates has a world mapping point, you can't actually know exactly which >> point it is if you don't constrain the Z value of the point in world. Thats >> because infinity points in world can map to a same point within the screen >> coordinate. So, if you're trying to make some sort of "Arcball" or Trackball >> feature using screen coordinates I can say that you don't need to convert >> those screen point into world points.. you just need a map from screen space >> to a open ball in R^3 using (centered at origin 0,0,0), for example, >> spherical coordinates (two angles).... >> >> to map from x,y into two angles (azimuth and zenith) you can do something >> like this: >> >> >> azimuth = ( 2*( x / screen_width ) - 1 ) * PI >> zenith = ( 2*( y / screen_height ) - 1 ) * (PI / 2) >> >> I've just came up with this mapping now, the're are many ways to build a >> trackball feature, thats just only an idea... to map the two angles above >> into a world vector within the open ball you can use: >> >> where r is an arbitrary ray of the ball (the biggest the ray the smallest >> is the rotation sensitivity) >> >> >> Hope it helps.... >> >> On Sat, Jul 5, 2008 at 3:06 AM, Jung Lee <[EMAIL PROTECTED]> wrote: >>> >>> Dear OpenSG Users, >>> >>> I found most of the solutions for my problems with OpenSG in this user >>> forum! Thank you! >>> However, there is one thing still couldn't find a way - how to convert >>> 2D mouse coordinates into OpenSG world coordinates. Pablo helped me >>> understand it, but I couldn't implement it yet. I found there was one >>> method which translate the world coordinates into screen coordinates >>> in OpenSG (getWorldtoScreen). My questions is that there exists sort >>> of getScreentoWorld function in OpenSG. If not, how can I convert >>> mouse's x,y coordinates into world coordinates (x, y, z)? >>> >>> Thank you always! >>> >>> Jung >>> >>> ------------------------------------------------------------------------- >>> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >>> Studies have shown that voting for your favorite open source project, >>> along with a healthy diet, reduces your potential for chronic lameness >>> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >>> _______________________________________________ >>> Opensg-users mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/opensg-users >> > > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Opensg-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/opensg-users > > ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Opensg-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users
