I don't get it at all.
Can you provide the exact wording of the question and possibly an associated drawing?
I have 4 points that each are 64 x,y values apart with different Z values that are arranged like this with 90 degree angles:
Also inside that square there is a 5th value I only have the X and Y value of and need to find the Z value of.
If anyone has any ideas on how to solve this id greatly appreciate it I have been at this for hours...
It actually is for a program im writing. I have been able to create a Z value grid that spans every 64 points on a plane (hence the 0-64 values). There will be a creation at point 5 that needs to be on the plane so as such I have to find an accurate height for the that point in relation to the surrounding 4 points based on there height. The lines from point 1 to 2 and 2 to 3 ect will be straight and not curved if that matters...
I see, I think, but it remains in appearance very ill-defined. What sort of relationship is supposed to hold for points in the square vs. the four corners?
1) You can average the four, I suppose.
2) One way I have used, from time to time, is the average of all five values. Yes, it's circular, but it does produce smooth results. It's almost the same as 1).
3) You can define some nice algebraic function to hold throughout each square. There are infinitely many varieties.
4) If you have a smooth function, do you need the edges to match up with their neighbors?
5) You can perform a simple weighting of the corners based on their distance from the desired point. In this case, using the Distance Formula:
(0,0) is 49.24 away from (20,45)
(0,64) is 27.59 away from (20,45)
(64,64) is 47.93 away from (20,45)
(64,0) is 62.94 away from (20,45)
As you probably do not want a direct relationship (more distance = more influence), you'll have to adjust to reverse that. I just subtracted each from the maximum possible distance, , to produce:
(0,0) is weighted as 41.26
(0,64) is weighted as 62.91
(64,64) is weighted as 42.57
(64,0) is weighted as 27.56
Total of all weights is 174.30
The weighting, then: . Of course, you could use more decimal places if you wish.
Well, that's a little discussion, but really, you just have to make up your mind what it is you want and what fits into your application.
all 4 sides have the same distance and really i don't care how i get the z value it just needs to be accurate in relation to the pathing of the other 4 points
What would be a formula for the 5 point thing? is seems like it might work
PS: I apologise for my lack or an simple explanation just i cant think of one... If you have AIM my sn is botanicvelious
Reverse what? Do you start with the four corners?
Four corners, x-y address of 5th point, and some arithmetic. That is all it is.
Note: I'm more fond of the weighting than a simple average, since a simple average would produce the same value for ALL points in the square. That may be inappropriate.
Then set , and For the fifth point ,
Since 3 points determine a plane, the fourth known point should satisfy
I'd solve the problem by using points (0,0), (64,0) and (0,64) to determine a triangle and corresponding plane with the Z values and the points (64,0), (0,64) and (64,64) to determine a second triangle and plane. Then depending which triangle the fifth point falls in, I'd put the fifth Z value on the corresponding plane using the method I suggested.
As an opportunity to use a program I wrote to create 3D graphs using LaTeX, I'll finish off my suggestion.
I'd solve the problem by using points (0,0), (64,0) and (0,64) to determine a triangle and corresponding plane with the Z values and the points (64,0), (0,64) and (64,64) to determine a second triangle and plane. Then depending which triangle the fifth point falls in, I'd put the fifth Z value on the corresponding plane using the following method.
The equation of a plane is . To determine the coefficients let be the value of for one of the four known points . For example, is the value for the point
Now let denote the fifth point. Take the first triangle to be (0,0), (64,0) and (0,64). The fifth point is in this triangle if Then set , and For the fifth point,
The second triangle is (64,64), (64,0) and (0,64). The fifth point is in this triangle if Then set , and For the fifth point,
Here is the picture using botanic's example with points (0,0,10), (64,0,4), (0,64,15) and (64,64,5) and fifth point (20,30, ). (I'm using a little different fifth point so it is not too close to the boundary of the two triangles.) The fifth point falls in the first triangle and has value 10.469 shown by the +.