| 08-22-2007, 07:20 PM | #1 |
I have 4 points that make a square on a plane. Each of those 4 points have an associated value that is there Z value. Kind of like this where 1,2,3, and 4 are the corners and 5 is the position of the unit 1----2 ----5-- ------- 3----4 Basically what is the formula to calculate value 5 should have? |
| 08-22-2007, 07:55 PM | #2 |
check any vector based system for terrain normal function. |
| 08-22-2007, 08:47 PM | #3 |
LOL I thought you gave this up by now. Well I guess some people simply have to learn on their mistakes. |
| 08-22-2007, 08:58 PM | #4 |
First off, you need triangles, not squares. Second, get the formula of the line it is on Third, get the point on the line Fourth, disregard your code and use GetLocationZ instead. oh and cohadar. You are talking about yourself, right? |
| 08-22-2007, 09:09 PM | #5 | |
Quote:
Yes why not, any other smart-ass observations? Perhaps calling me stupid because you did not bother to read the post entirely? |
| 08-22-2007, 11:01 PM | #6 |
Easy way is to use finite element shape functions, for both triangle and square. For triangle you use 'area' or 'barycentric' coordinates, look it up For a square, you take the sum of four functions, each of which is 1 at one of the corners of the square and 0 at all the others. For example, on the unit square, you would use xy, (1-x)y,(1-x)(1-y),x(1-y). Evaluate that vector at your position and dot (multiply and add one by one) it with the vector of values at the corners to get the value at x,y. |
| 08-22-2007, 11:37 PM | #7 |
k so i would use the formula (1-x)y,(1-x)(1-y),x(1-y) however how would i use that? since wc3 uses a 64 point pathing map a square would be this 0,0 64,0 0,64 64,64 So I would take the units x - (x / 64) and y - (y/64) but how would i add back the remainder? Also what is correct for use in the above formula? EDIT: MATH |
