Results 1 to 3 of 3

Thread: convert data points to graph coordinates

  1. #1

    convert data points to graph coordinates

    This should be simple... but I'm having a hard time coming up with an equation that works every time.

    Let's say I have a point, p=(91,1), and I need to plot it on my 2d graph, which, in OpenGL has the x-axis: (1, -> (9,, and the y-axis: (1, -> (1,1), because y increases in the downward direction.

    So, how do I convert the point 'p' so that is shows at the right place on the graph?

    Cheers.

  2. #2

    Re: convert data points to graph coordinates

    I should add that the point p=(91,1) is actual data. So, I do know the max x and max y values as well.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Feb 2004
    Posts
    248

    Re: convert data points to graph coordinates

    1:1 scale
    ---------
    graph_x = 1+x
    graph_y = 8-y

    scaled
    ------
    graph_x = 1+(x/max_x*
    graph_y = 8-(y/max_y*7)

    But that is surely not what you are looking for? You need to be more elaborate.

Similar Threads

  1. Convert windows mouse coordinates to opengl coordinates
    By throwaway in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-05-2013, 06:44 PM
  2. Cluster data points to levels on graph
    By s5804 in forum OpenGL: General
    Replies: 3
    Last Post: 01-06-2010, 11:39 AM
  3. I need to convert quad data to triangle data!!
    By bansheeogl in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 05-14-2005, 06:51 PM
  4. Replies: 4
    Last Post: 05-24-2004, 09:03 AM
  5. convert window coordinates to OpenGL coordinates
    By grodslukaren in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-02-2001, 11:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean