Thread: 2d graphing

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    46

    2d graphing

    Hello all,

    I'm trying to draw a 2D graph based off of the function e^-(x^2 + y^2). I was origionally thinking I could use two for loops and connect the points with the line function; however, since this is a 2D graph, I'm thinking that won't work, as it would connect every Y coordinate to EVERY x coordinate. Now I'm thinking it might be easier to evaluate the function at simply turn a pixel on at each location... Would that work, or would it be easier to treat the funtion as two separate functions (by separating the variables)?

    The function is actually a double integral, evaluated from negative infinity to positive infinity both times, if that helps anyone think about it

    thanks!!
    -maxthecat

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    That function doesn't make sense, since it doesn't equal to anything ie: e^-(x^2 + y^2) = 123
    Therefore, if you plot it in a graph the entire screen would be filled.

    On the other hand, If you plot it in 3D, you would get a nice plane (assuming z is the function value).
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 2D in directX
    By fighter92 in forum Game Programming
    Replies: 6
    Last Post: 01-25-2009, 11:23 AM
  2. Help with 2d arrays
    By thamiz in forum C Programming
    Replies: 25
    Last Post: 05-25-2008, 05:06 AM
  3. Replies: 16
    Last Post: 09-22-2006, 03:39 PM
  4. Replies: 0
    Last Post: 01-20-2006, 11:11 AM
  5. returning 2D arrays
    By ... in forum C++ Programming
    Replies: 2
    Last Post: 09-02-2003, 12:28 PM