Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Gaming > Development Programming Algorithms > Re: Altitude of...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 17 Topic 581 of 680
Post > Topic >>

Re: Altitude of a point in a triangle

by Miss Elaine Eos <Misc@[EMAIL PROTECTED] > Sep 15, 2006 at 01:12 AM

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.
 




 17 Posts in Topic:
Altitude of a point in a triangle
Miss Elaine Eos <Misc@  2006-09-14 17:10:54 
Re: Altitude of a point in a triangle
Erik Max Francis <max@  2006-09-14 13:24:04 
Re: Altitude of a point in a triangle
Miss Elaine Eos <Misc@  2006-09-14 23:04:33 
Re: Altitude of a point in a triangle
Erik Max Francis <max@  2006-09-14 17:01:36 
Re: Altitude of a point in a triangle
"Alfie [UK]" &l  2006-09-15 02:04:43 
Re: Altitude of a point in a triangle
Erik Max Francis <max@  2006-09-15 13:49:39 
Re: Altitude of a point in a triangle
Miss Elaine Eos <Misc@  2006-09-15 01:12:41 
Re: Altitude of a point in a triangle
Erik Max Francis <max@  2006-09-15 13:49:09 
Re: Altitude of a point in a triangle
Tom Plunket <gamedev@[  2006-09-21 16:26:51 
Re: Altitude of a point in a triangle
Erik Max Francis <max@  2006-09-22 15:22:10 
Re: Altitude of a point in a triangle
Tom Plunket <gamedev@[  2006-09-23 19:12:17 
Re: Altitude of a point in a triangle
Erik Max Francis <max@  2006-09-23 19:22:19 
Re: Altitude of a point in a triangle
Tom Plunket <gamedev@[  2006-09-24 12:54:02 
Re: Altitude of a point in a triangle
Erik Max Francis <max@  2006-09-24 21:33:53 
Re: Altitude of a point in a triangle
Tom Plunket <gamedev@[  2006-09-25 14:28:47 
Re: Altitude of a point in a triangle
Erik Max Francis <max@  2006-09-25 15:58:10 
Re: Altitude of a point in a triangle
Miss Elaine Eos <Misc@  2006-09-15 01:04:18 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 2:07:57 CDT 2008.