In article <2-ydnUUNQKr-cJTYnZ2dnUVZ_omdnZ2d@[EMAIL PROTECTED]
>,
Erik Max Francis <max@[EMAIL PROTECTED]
> wrote:
> Miss Elaine Eos wrote:
> > I thought that altitude would be clear from my description that it's a
> > terrain mesh. The implication is that my triangles are laid out on an
> > XZ grid, with their corners at various "altitudes" (Ys).
> >
> > The formula you give tells me the altitude at the point that's in the
> > exact center of the triangle. The thing I'm wrestling with is how to
> > average the 4th point ANYWHERE within (XZ-wise, that is) the triangle.
> >
> > What I came up with so far is below and, while it seems right on
> > code-review, it's giving me "funny looking" results (they seem too
high).
>
> It's still not clear to me what you're asking for. You're talking about
> averages, but then saying it's not the average (but then continuing to
> talk about averages).
>
> The altitude of a triangle means the distance between one of its points
> and the line defined by its other two points (you know, the area of a
> triangle is half the base times the altitude ...). But it's clear from
> the 3D context that that's not what you're talking about either.
Got it. I'm not talking about 2d triangle altitudes. In a 3D terrain
mesh, the triangles are laid out on an XZ grid -- like XY graph paper
for 2D, but you use Z instead of Y to represent the "other" axis of the
grid laid over a "flat" world, because "Y" is used for "altitude" as in
"...of the airplane." The triangles themselves are laid flat on the
ground, but the airplane flying directly over a particular triangle has
an "altitude."
So, what I'm describing is this: imagine a flat checkerboard, wherein
all the squares are sliced diagonally, so it's a grid of triangles. Now
raise & lower a bunch of the corners, so you have a "bumpy" checkerboard
-- that's a "terrain mesh"; it's mostly flat, but each corner may be up
or down a bit to represent a hill or mountain or valley, etc. It may
look a bit like a checkered sheet fluffed over some lumpy thing.
Anyway, the problem I was having is: I had a point which was known to be
INSIDE one of the triangles, and on its plane. My question was: given
the altitude (Y-coordinates) of the 3 corners of the triangle, and the
XZ of the point within the triangle, how to I determine the altitude (Y
coordinate) of the 4th point?
....And the answer lies in a sort of averaging of the 3 corner points,
but weighted by the inverse of the 4th point's distance from each of
them.
As described in my "I figured it out" post, the problem was that my
weighting function was accounting too-much for the closeness of p4 to
the triangle corners.
> Are you asking what the projection of P would be onto the plane defined
> by the triangle? In other words, if you change P's y-coordinate so that
> it is contained within that plane, what would that y-coordinate be?
Right.
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.
--
Please take off your pants or I won't read your e-mail.
I will not, no matter how "good" the deal, patronise any business which
sends
unsolicited commercial e-mail or that advertises in discussion newsgroups.


|