Archived

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

AdmiralBinary

Quad Height Thingy

Recommended Posts

AdmiralBinary    100
Just a quick (and simple, I hope) question: Given four vertices and an x/y coordinate somewhere inside them, what would it take to figure out the altitude at that point? --------------- #define TRUE 0 #define FALSE 1 //MUAHAHAHAHAAAA!

Share this post


Link to post
Share on other sites
Strange Monkey    122
I'm not very sure, but first, get the normal of the plane the quad is on and then normalize it. Then do the dot product between the normal and vector between the Point and one of the four vertices of the quad.
( N=normal, P=Point, V=One of the four vertices) Altitude = dotp( N , P-V ).

[edited by - Strange Monkey on May 4, 2002 10:13:30 AM]

Share this post


Link to post
Share on other sites
Cedric    158
I''m not sure that StrangeMonkey''s method works, but here is what I''d do (I hope it''s not the same thing he said): find the normal of the quad:

Normal = (A, B, C)

and plug it into the plane equation

Ax + By + Cz + D = 0

plug a (x,y,z) triple that''s part of the plane (any of the four vertices) to find D

D = -Ax - By - Cz

Then isolate y

Altitude = y = (-Ax - Cz - D) / B

It should be pretty fast (you don''t have to normalize anything), but I''m sure there is room for improvement.

Cédric

Share this post


Link to post
Share on other sites
AntilogicHyper    160
Wassup !!!... wow Tim you got some replies, finally.
At the moment, when you move... you kinda appear "jump" to the nearest poly, kinda not good looking..

I know this, because If it wasnt for my ideas he wouldnt have this obstacle

--------------------------------

Lead Design, Lead Artist
WhitespaceUnlimited

Share this post


Link to post
Share on other sites