Erik Max Francis wrote:
> > And again, sorry if I'm being unclear. I normally try to be pretty
good
> > about this stuff, but I guess I'm very tired this week, as I've caught
> > myself asking a couple of questions that just turned out to be silly
> > bugs on my part. I'll be more careful, going forward.
>
> The vector solution for this, by the way, would be to write out the
> vector equation of the plane:
>
> {x: (x - p) dot n = 0},
If you want to determine the distance from a point to a triangle along a
given vector, this is most certainly not the correct solution. Miss
Elaine was looking for where the Y-down vector intersected the triangle,
regardless of the triangle's normal.
....which makes me realize that the problem can be a lot simpler than I
previously was making it out to be...
In short, compute the distance from the point to the plane (as Erik
provides above). Divide that distance by the dot product of the normal
with the "down" vector (e.g. { 0, -1, 0 }). Scale the "down" vector by
that scaled distance. Note that this doesn't validate that the point is
over the triangle; as this is a "distance to plane" function, you've
still got to do your own rejection if the point isn't within any
triangle. You can sanity-check by dotting this new "altitude vector"
with the triangle's normal, and you should get back the
distance-to-plane that you computed earlier.
....I think. ;)
-tom!
--


|