Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,014 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Need help with 3D Cursor [Re: Espér] #388633
12/05/11 10:46
12/05/11 10:46
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
You definitely are kidding us oO
The plane is imaginary, it assumingly starts at 0|0 and expands along the X and Y axis but stays 0 along the Z axis. Then an arbitrary point on this plane would be 0|0|0.
The normal of your imaginary plane is probably 0|0|1 since your plane faces upwards.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Need help with 3D Cursor [Re: WretchedSid] #388634
12/05/11 10:57
12/05/11 10:57
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
k.. i don´t understand it..

i think i´ll shut down my PC now and get well.. perhaps i can think clearer when i´m not ill ._.

Thanks anyway...


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Need help with 3D Cursor [Re: Espér] #388720
12/06/11 21:25
12/06/11 21:25
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline
User
Carlos3DGS  Offline
User

Joined: Oct 2008
Posts: 513
I programmed the same thing as the link they gave you, so I might be able to help explain it.

as you know a line can be represented mathematically in two ways.
1- two points
2- a point and a direction

planes work the same way and they can also be calculated in two ways.
1- three points
2- a point and a normal

This information is only nneded to calculate it mathematically, you don't need a real phisical line, and you dont need a real phisical terrain either.


In his funtion he is using as input for the line the first method (two points), and for the imput to calculate the plane he is using the second method (a point and a normal).
-to give the inputs for the line you just need to give the function any two points on the line. for example (in your case) transforming the cursor's screen coords to the 3d view with a depth of 1, and transforming the cursor coords again to 3d coords with a depth of 2.
-to give the inputs for the plane you need to give it ANY point that is ON the imaginary plane, and the imaginary plane's normal. for example (in your case) if you wanted the plane to be at a height of z=0 you can give it any point on that plane. that means that you could pass any value for x and any value for y as long as you passed 0 for the z value (since all points with z=0 would be on that imaginary plane's surface).
For the normal you would give 0,0,1 if you want your plane's surface to be horizontal since that would mean it's surface normal would be pointing upwards.

You only need the values of this imaginary line and the imaginary plane so he can calucate it mathematically, you do not need to have them phisically loaded.

the output will be either a coordinate where they intersect, or NULL if the line is parallel to the plane (because then it never intersects with our imaginary plane).

How the function does this is irrelevant but if you wish to know... with the two vectors of the line it calculates the formula that defines that line, and with the point and normal for the plane it calculates the formula that will define that plane. then it simply plugs the values for one formula into the other formula and the result is the intersection of both. If you want to achieve this yourself you can read about it in any basic calculus book to learn how to create a formula that defines a line, how to create the formula that defines a plane, and how to calculate the intersection of both.

If you wish to learn in a more visual way, follow the links below for an online video demonstration:
LINES: http://www.youtube.com/watch?v=GFM8NOe_XM4
PLANES: http://www.youtube.com/watch?v=3QLaud6SnHM
INTERSECTIONS: http://www.youtube.com/watch?v=-_DStDQffQo

and here is the best (and most detailed) video I found on this subject. This video covers everything from 2d line equations and the basic concepts of planes, all the way to the more complex stuff you can do with this in 3d (like line and plane intersections).
http://www.youtube.com/watch?v=Q0gnrV699GQ
in my opinion this last video is a must-watch for anyone programming in 2d/3d
Hope I helped ;D


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1