Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Tue Mar 19, 2024 6:51 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Tue Sep 16, 2008 12:11 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
I have a 3D position (x,y,z) and I want to know the coordinates of 2D window that correspond to the projection of that point.
How can i do that?


Top
 Profile  
 
PostPosted: Tue Sep 16, 2008 9:13 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
See raydium_osd_printf_3D() for instance, it did that sort of "unproject" things. We may even provide this feature as a function (raydium_math_3D_unproject() ?) since it's a quiet common need, don't you think ?


Top
 Profile  
 
PostPosted: Tue Sep 16, 2008 11:14 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
Hmm, yes, i'll try


Top
 Profile  
 
PostPosted: Wed Sep 17, 2008 11:54 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
Done.
I've changed the name a bit to be more friendly with our "autocompletion" rule.
Now it is: raydium_math_point_unproject_3D

Also I've added a new function (that I think is quite usefull) to get the real radian angle of a vector given by its X and Y projections:
raydium_math_angle_get_from_projections (As well I have tried to get the autocompletion idea here)


Top
 Profile  
 
PostPosted: Wed Sep 17, 2008 8:43 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
Nice. I'll update a bit the unproject function (when sz>1), and factorize a bit code so that printf_3D use this function. About the other function, the "get" from the name seems a bit useless to me (if you call the function, it's because you want to get something) and is redundant with function prototype. But "raydium_math_angle_from_projections()" seems ok to, if you want to update the name.

I wonder if I'm not some sort of function names monomaniac, or something :)

I must admit that I don't *really* understand what this function did, anyway ;) (the problem is on my side, don't worry) Just curiosity, but what do you mean by vector projection ? Projection on what ?


Top
 Profile  
 
PostPosted: Wed Sep 17, 2008 9:22 pm 
Offline

Joined: Sun Oct 09, 2005 10:46 pm
Posts: 759
Hello,

This function looks like atan2 ? no ?

Have a nice day.
Ouille.


Top
 Profile  
 
PostPosted: Wed Sep 17, 2008 10:37 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
well...
Looks like atan2 but atan2 returns in the range -PI to PI and our returns in range 0 to 2*PI

About the name... ok, the get maybe is useless here ( if fact we can not set anything)
Commit done.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group