Results 1 to 15 of 15

Math Help - Z value of point in square

  1. #1
    Newbie
    Joined
    Aug 2007
    Posts
    8

    Z value of point in square

    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:

    0,0 64,0


    0,64 64,64


    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...
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Joined
    Aug 2007
    From
    USA
    Posts
    3,111
    Thanks
    2
    I don't get it at all.

    Can you provide the exact wording of the question and possibly an associated drawing?
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Aug 2007
    Posts
    8
    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...
    Attached Thumbnails Attached Thumbnails Z value of point in square-picture-50.jpg  
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor
    Joined
    Aug 2007
    From
    USA
    Posts
    3,111
    Thanks
    2
    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, 64*\sqrt{2}, 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: \frac{41.26(10)+62.91(15)+42.57(5)+27.56(4)}{174.3  0} = 9.63. 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.
    Last edited by TKHunny; August 22nd 2007 at 09:22 PM. Reason: I really wasn't done.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Aug 2007
    Posts
    8
    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
    Follow Math Help Forum on Facebook and Google+

  6. #6
    MHF Contributor
    Joined
    Aug 2007
    From
    USA
    Posts
    3,111
    Thanks
    2
    Please read my revisions, above.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Newbie
    Joined
    Aug 2007
    Posts
    8
    ok i get what you did just how do i reverse it?
    Follow Math Help Forum on Facebook and Google+

  8. #8
    MHF Contributor
    Joined
    Aug 2007
    From
    USA
    Posts
    3,111
    Thanks
    2
    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.
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Newbie
    Joined
    Aug 2007
    Posts
    8
    no i mean to reverse the weighting because it would need LESS weight farther away

    Also what about making it into a set of 4 right triangles?
    Follow Math Help Forum on Facebook and Google+

  10. #10
    Senior Member
    Joined
    Apr 2006
    Posts
    399
    Awards
    1
    Quote Originally Posted by botanic View Post
    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:

    0,0 64,0


    0,64 64,64


    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...
    Quote Originally Posted by botanic View Post
    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...
    The equation of the plane we will take to be aX + bY + Z = c. To determine the coefficients a,\ b \text{ and }c, let Z_{X,Y} be the value of Z for one of the four known points (X,Y). For example, Z_{0,64} is the Z value for the point (X,Y) = (0,64).

    Then set c = Z_{0,0}, a = (Z_{0,0} - Z_{64,0})/64 and b = (Z_{0,0} - Z_{0,64})/64. For the fifth point (X,Y), Z_{X,Y} = c - aX - bY.

    Since 3 points determine a plane, the fourth known point should satisfy Z_{64,64} = c - 64a - 64b.
    Last edited by JakeD; August 22nd 2007 at 09:52 PM. Reason: Added note about 4th known point.
    Follow Math Help Forum on Facebook and Google+

  11. #11
    MHF Contributor
    Joined
    Aug 2007
    From
    USA
    Posts
    3,111
    Thanks
    2
    ?? Plane? We know 4 and are determining the 5th.
    Follow Math Help Forum on Facebook and Google+

  12. #12
    MHF Contributor
    Joined
    Aug 2007
    From
    USA
    Posts
    3,111
    Thanks
    2
    Quote Originally Posted by botanic View Post
    no i mean to reverse the weighting because it would need LESS weight farther away
    This is already in the original description above. Initial distances are subtracted from the maximum possible distance.

    Also what about making it into a set of 4 right triangles?
    That is essentially what was done with the distance formula.
    Last edited by TKHunny; August 23rd 2007 at 05:26 AM. Reason: typo
    Follow Math Help Forum on Facebook and Google+

  13. #13
    Senior Member
    Joined
    Apr 2006
    Posts
    399
    Awards
    1
    Quote Originally Posted by botanic View Post
    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...
    Quote Originally Posted by TKHunny View Post
    ?? Plane? We know 4 and are determining the 5th.
    Yeah, the talk of a plane and an accurate height threw me off. Instead, the 4 points are not on a plane and there is no unique accurate height.

    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.
    Last edited by JakeD; August 23rd 2007 at 08:34 AM.
    Follow Math Help Forum on Facebook and Google+

  14. #14
    Senior Member
    Joined
    Apr 2006
    Posts
    399
    Awards
    1
    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 aX + bY + Z = c. To determine the coefficients a,\ b \text{ and }c, let Z_{X,Y} be the value of Z for one of the four known points (X,Y). For example, Z_{0,64} is the Z value for the point (X,Y) = (0,64).

    Now let (X,Y) 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  X + Y \le 64. Then set c = Z_{0,0}, a = (Z_{0,0} - Z_{64,0})/64 and b = (Z_{0,0} - Z_{0,64})/64. For the fifth point, Z_{X,Y} = c - aX - bY.

    The second triangle is (64,64), (64,0) and (0,64). The fifth point is in this triangle if  X + Y \ge 64. Then set c = Z_{64,0} + Z_{0,64} - Z_{64,64}, a = (Z_{64,64} - Z_{0,64})/64 and b = (Z_{64,64} - Z_{64,0})/64. For the fifth point, Z_{X,Y} = c - aX - bY.

    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, Z). (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 Z value 10.469 shown by the +.

    \setlength{\unitlength}{.1cm}\begin{picture}(83,59  )(-10,-20)<br />
\qbezier(19,29)(19,29)(48,-8)\put(23,14){+}<br />
\qbezier(48,-8)(48,-8)(48,-10)\qbezier(48,-8)(48,-8)(-0,7)\qbezier(48,-8)(48,-8)(63,14)\qbezier(48,-10)(48,-10)(0,0)\qbezier(48,-10)(48,-10)(63,11)\qbezier(-0,7)(-0,7)(0,0)\qbezier(-0,7)(-0,7)(19,29)\qbezier(63,14)(63,14)(63,11)\qbezier(6  3,14)(63,14)(19,29)\end{picture}<br />
    Follow Math Help Forum on Facebook and Google+

  15. #15
    Newbie
    Joined
    Aug 2007
    Posts
    8
    Much thanks now i just need to convert that into a programmable format and im good to go
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Finding Point along square's diagnal
    Posted in the Geometry Forum
    Replies: 2
    Last Post: September 16th 2011, 08:58 AM
  2. Replies: 3
    Last Post: July 2nd 2011, 07:03 PM
  3. from the point inside the square
    Posted in the Trigonometry Forum
    Replies: 1
    Last Post: December 3rd 2010, 04:04 AM
  4. How to check if a point is in a square?
    Posted in the Geometry Forum
    Replies: 3
    Last Post: November 5th 2010, 05:50 AM
  5. Replies: 4
    Last Post: November 3rd 2006, 09:14 PM

Search Tags


/mathhelpforum @mathhelpforum