height on a heighmap at position x,z ?

Started by
16 comments, last by blizzard999 18 years, 7 months ago
Quote:Original post by cybergolem
Quote:Original post by blizzard999
Solution: compute the triangle-plane and resolve by y


aaarg, please no planes !
I still don't think in planes or vectors, just plain coordinate system :-)


Probably it's better you learn something, or not ?

write         ux = x2 - x1    uy = y2 - y1    uz = z2 - z1        vx = x3 - x1    vy = y3 - y1    vz = z3 - z1then        Nx = uy * vz - uz * vy        Ny = uz * vx - ux * vz        Nz = ux * vy - uy * vx        d  = - ( Nx * x1 + Ny * y1 + Nz * z1 )     finally       y = - ( Nx * x +  Nz * z + d ) / Ny          where x and z are the 2D coordinates                 y is the height you are searching for
Advertisement
Quote:Original post by timw
god I gotta step out of raytracing mode lol. my renderer project is turning me insane.

Tim


[lol]

...

ray tracing method can be usefull if you dont know the triangle or if you have to select the triangle.
thanks blizzard999, thats something I can understand.
Excuse my english, I am only German
Quote:Original post by cybergolem
thanks blizzard999, thats something I can understand.


You mean - something you can just blindly copy.

Edit (in the light of what Rasmadrak wrote):

This comment was meant to be constructive (as well as expressing a little exasperation!) because it seems a shame to me for someone to so strongly avoid understanding the background to a solution, because they'll never learn anything that way. The solution (in terms of words and pseudo code) had already been posted - it seems like copy'n'paste code was the only thing that satisfied. I used to see this when assisting in programming classes - people would put far, far more effort in tryng to wheedle a verbatim "solution" out of you than to understand the problem.

[Edited by - MrRowl on September 9, 2005 9:15:55 AM]
I disagree with the poster above, sometimes the solution, or at least the understanding of it, isn't obvious until you get it smacked in your face.

Blizzard could also have written in it text form aka pseudo code.... so don't blame the OP if someone posts an "complete" solution... :)
"Game Maker For Life, probably never professional thou." =)
The second 'solution' I posted is not the solution...it's the code you can cut and past.
There is nothing to understand.
Personally, I like complete code with a little bit of explanation, rather than pseudo code. Or if it's not even complete, at least a couple of lines to get somebody going. That, and a lot of people here don't type the best english, so you can't understand what they are trying to say. I love to learn by example, rather than be told what's going to happen. It's like sitting through a chemistry class where all you do is read the book, versus a chemistry class where the teacher has lots of labs, or does up front demonstrations.

Edit: Not to mention that half the pseudo code I read I don't even understand what they are getting at, and english is my primary language. How do you think somebody who is still learning english is understanding it?
Quote:Original post by IgnisDeus
Personally, I like complete code with a little bit of explanation, rather than pseudo code. Or if it's not even complete, at least a couple of lines to get somebody going. That, and a lot of people here don't type the best english, so you can't understand what they are trying to say. I love to learn by example, rather than be told what's going to happen. It's like sitting through a chemistry class where all you do is read the book, versus a chemistry class where the teacher has lots of labs, or does up front demonstrations.

Edit: Not to mention that half the pseudo code I read I don't even understand what they are getting at, and english is my primary language. How do you think somebody who is still learning english is understanding it?


Hey guys, what are you talking about?

I posted the mathematic solution for a really simple problem (I studied it when I was 14 and be sure I'm not a geek).
Then, because cybergolem is afraid of planes and vectors :) (probably too young?), I (re)wrote a second post with the code. The code is simply the scalar expansion of the previous equations, nothing more.
I dont think it could be possible to explain it in a simpler way. If you think otherwise, you can comment the code in a cleaner english [smile]

Peace and love boy. Peace and love.

This topic is closed to new replies.

Advertisement