Results 1 to 4 of 4
Like Tree1Thanks
  • 1 Post By emakarov

Math Help - How to find coordinate of node in triangle?

  1. #1
    Senior Member
    Joined
    Sep 2009
    Posts
    300

    Exclamation How to find coordinate of node in triangle?

    Hi,

    If I have a triangle like this:

    1 2 4 7 11 16
    3 5 8 12 17
    6 9 13
    10 14
    15
    ... which goes on to contain $n$ numbers (although I don't think the size is relavent).

    Notice the way it's ordered. The numbers can be considered as the ordinal index of a node of the triangle. The numbers are ordered going diagonally from top right to bottom left, and creating a new diagonal line which is longer as you go right.

    The problem is, given a node with ordinal index $q$, how can I find what the $x$ and $y$ coordinate is of $q$? Is there a formula?

    For example:
    get_x_index(13) = 2
    get_y_index(13) = 2

    get_x_index(17) = 4
    get_y_index(17) = 1

    Does anyone know how to do this?

    Thanks.
    Last edited by Sneaky; March 2nd 2013 at 06:30 PM.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Joined
    Oct 2009
    Posts
    5,561
    Thanks
    785

    Re: How to find coordinate of node in triangle?

    The function that maps two coordinates into a node index is similar to Cantor pairing function (in the linked page, indices start from 0). See section "Inverting the Cantor pairing function".
    Thanks from Sneaky
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Senior Member
    Joined
    Sep 2009
    Posts
    300

    Re: How to find coordinate of node in triangle?

    ok thanks, that worked, but now given the triangle has n numbers where n is the amount of numbers in the triangle, how can I find the width and height of the triangle?
    In the example in the beginning post, the width would be 6 and the height would be 5.
    Last edited by Sneaky; March 2nd 2013 at 07:25 PM.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor
    Joined
    Oct 2009
    Posts
    5,561
    Thanks
    785

    Re: How to find coordinate of node in triangle?

    Quote Originally Posted by Sneaky View Post
    ok thanks, that worked, but now given the triangle has n numbers where n is the amount of numbers in the triangle, how can I find the width and height of the triangle.
    If you find the x and y coordinates of n, then I think that one of the dimensions of the triangle is x + y and the other one is either x + y or x + y - 1 depending on whether x (or maybe y) is 0.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Coordinate of a point in a triangle
    Posted in the Geometry Forum
    Replies: 4
    Last Post: January 27th 2011, 03:10 PM
  2. Replies: 4
    Last Post: January 31st 2010, 03:26 AM
  3. coordinate geometry triangle
    Posted in the Geometry Forum
    Replies: 1
    Last Post: November 25th 2009, 01:46 AM
  4. the coordinate of Centroid of a Triangle
    Posted in the Geometry Forum
    Replies: 1
    Last Post: October 20th 2009, 07:47 PM
  5. find the area coordinate triangle
    Posted in the Pre-Calculus Forum
    Replies: 4
    Last Post: October 21st 2007, 05:31 PM

Search Tags


/mathhelpforum @mathhelpforum