marching coordinates II

This is a discussion on marching coordinates II within the C Programming forums, part of the General Programming Boards category; Anyone out there who can make the x[i] go forth and back ? Code: for(i=0;i<N-1;i++) { if(x[i]<1) x[i+1]=x[i]+Vx*dt; else x[i+1]=x[i]-Vx*dt; ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    13

    marching coordinates II

    Anyone out there who can make the x[i] go forth and back ?
    Code:
    for(i=0;i<N-1;i++)
    	{
    		if(x[i]<1) x[i+1]=x[i]+Vx*dt;
    		else  x[i+1]=x[i]-Vx*dt; }
    I want to create something like 0.0 , 0.1 , ... , 0.9 , 1.0 , 0.9 , ... , 0.1 , 0.0 , -0.1 , ... , -1.0 , -0.9 , -0.8 , ...
    and so on as long as i<N, Vx means a velocity and dt means a time jump.

    Thank you

    joerg

  2. #2
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    Why on earth did you start a new thread? I take it you didn't read the forum guidelines? Please take a read off them and don't make two threads of the same topic!

  3. #3
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Replies here:

    Marching coordinates
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get relative mouse coordinates when GLUT return absolute
    By joeprogrammer in forum Game Programming
    Replies: 14
    Last Post: 02-10-2009, 06:35 PM
  2. Marching coordinates
    By joerg in forum C Programming
    Replies: 30
    Last Post: 04-12-2007, 04:03 PM
  3. Global coordinates in OpenGL?
    By IcyDeath in forum C++ Programming
    Replies: 1
    Last Post: 11-25-2004, 06:29 PM
  4. Converting from Screen to World Coordinates
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 05-11-2004, 01:51 PM
  5. Size of 1 pixel
    By ooosawaddee3 in forum C++ Programming
    Replies: 4
    Last Post: 07-26-2002, 09:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21