Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

This topic is 5700 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve asked this question ones but I didn''t get any good answer. I have a plane - a triangle, and I know the coordinates of it''s vertices. How do I found the Y (Height) of any given x,z on this plane? Sorry for my English. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
you take the percentage of the slope and add it to the xz

Share this post


Link to post
Share on other sites
Extract the plane equation:

ax + by + cz + d = 0

Rearrange:

y = (- d - ax - cz) / b

To get the plane eqn:

(v1,v2,v3 is triangle verts)

e1 = v2 - v1
e2 = v3 - v1

normal = normalize( cross(e1,e2) )

where cross takes two vectors and returns the cross product, normalize takes a vector and returns the normalized (unit) version.

then in the above equation:

a = normal.x
b = normal.y
c = normal.z
d = -dot(normal,v1)

Share this post


Link to post
Share on other sites
quote:
Original post by JuNC
...
normal = normalize( cross(e1,e2) )
...
a = normal.x
b = normal.y
c = normal.z
d = -dot(normal,v1)




Right! However you dont need do normalize the normal if you dont need the ''normal'' explicitly (ie.: light).

So, given 3 points P0, P1, P2
simply
vector3 normal = (P2-P0)^(P1-P0) = (a, b, c)
and float d = - normal * P0

-> y = -(a*x + c*z + d)/b




Share this post


Link to post
Share on other sites
guys, dont talk so complicated. If he ask this question, its probably he dont know VECTOR ALGEBRA.

What you want to do is to find intersection point between a plane and a line?

Share this post


Link to post
Share on other sites
quote:
Original post by Daivuk
guys, dont talk so complicated.



If someone find this math complicated...leave 3D graphics...it''s better! I''ve studied these topics at school when I was 14...(a lot of time ago... )

quote:

What you want to do is to find intersection point between a plane and a line?


No!


Share this post


Link to post
Share on other sites
14 ?!!!!!!!?
Damn, where did you go at school??
Me I learned it at 19 at college.
long time ago too

Share this post


Link to post
Share on other sites
quote:
Original post by Daivuk
guys, dont talk so complicated. If he ask this question, its probably he dont know VECTOR ALGEBRA.

What you want to do is to find intersection point between a plane and a line?



I understood what he was saying and I have already done something similiar. My mistake was using "-" instead of "+" so I have solved my problem.
Thank you.

Share this post


Link to post
Share on other sites
quote:
Original post by blizzard999

If someone find this math complicated...leave 3D graphics...it''s better! I''ve studied these topics at school when I was 14...(a lot of time ago... )





I have studied it at the age of 13 by myself. :D

Share this post


Link to post
Share on other sites
quote:

I have studied it at the age of 13 by myself. :D



I was obliged of course...at 13 I had other things in my head

Seriously...geometry is a lot simpler than linear algebra or other ''math topics''

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!