
Advertisement
Sign in to follow this
Followers
0
Calculating height at an arbitrary position on a quad
By
metsfan, in Math and Physics
This topic is 2254 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
(where Q0 through Q3 are the points of the quad. D could be rewritten as D = (A*x + B*y + C*z) where x,y,z are the components of Q0, if that makes more sense to you.)
so expanding it out a bit:
[indent=1]Py = (Nx * Px + Nz * Pz  (N dot Q0)) / Ny
I'm sure a google search or two could explain the details better than I have, but hopefully this is enough info to get you going.
0
metsfan 679
Hey all,
Thanks for the help! I was able to figure out the solution using Ray/Plane intersection, which looks similar to what you guys did. Here is the code snipit that performs the primary calculations, for future people:
Thanks again for the response.
Thanks for the help! I was able to figure out the solution using Ray/Plane intersection, which looks similar to what you guys did. Here is the code snipit that performs the primary calculations, for future people:
vec4 S = vec4(Px, 0.0f, Pz, 1.0f); // Ray start position
vec4 V = vec4(0.0f, 1.0f, 0.0f, 0.0f); // Ray directional
vec3 N = glm::normalize(glm::cross(P1  P0, P2  P0)); // Normal Vector
vec4 L = vec4(N, glm::dot(N, P0)); // Plane Vector
float Py = (glm::dot(L, S) / glm::dot(L, V)); // Calculate final Y value
return Py;
Thanks again for the response.
0
Sign in to follow this
Followers
0

Advertisement
s=(PxV1.x) / (V2.xV1.x)
t=(PzV1.z) / (V3.zV1.z)
y1 = V1.y + s*(V2.yV1.y)
y2 = V3.y + s*(V4.yV3.y)
Py = y1 + t*(y2y1)
In effect, you are calculating the parameters s and t that correspond to the point, P, on the plane. Then you are using these parameters to interpolate the Y values of the 4 points.
Share this post
Link to post
Share on other sites