Programming ??? Math Question

galantida:
I pass the coordinates to draw a line from 4,1,4 to 4,6,4 at color 6. [e.g. Line(4,1,4,4,6,4,6) ]

I would think this would light the six LEDs between those two points

4,1,4
4,2,4
4,3,4
4,4,4
4,5,4
4,6,4

what it does is light 4,1,4 and 4,1,4.

Well, let's test it shall we?

// set all the points on a line to a color
void Line(float xa, float ya, float za, float xb, float yb, float zb, int color)
  {
    float x,y,z;
   
    // calculate the legnth
    float xl = xa-xb; 
    float yl = ya-yb;
    float zl = za-zb;
   
    for (float t=0; t<8.0f; t++)
    {
      x = xa + ((xl/8.0f) * t);
      y = ya + ((yl/8.0f) * t);
      z = za + ((zl/8.0f) * t);
      Point(x,y,z,6); 
    }
  }
 
 void Point (int x, int y, int z, int color)
   {
   Serial.print (x);
   Serial.print (", "); 
   Serial.print (y);
   Serial.print (", "); 
   Serial.print (z);
   Serial.println (); 
   }
    
 void setup ()
  {
  Serial.begin (115200);
  Serial.println ();
  Line(4,1,4,4,6,4,6);
  }  // end of setup

void loop () { }

Output:

4, 1, 4
4, 0, 4
4, 0, 4
4, 0, 4
4, -1, 4
4, -2, 4
4, -2, 4
4, -3, 4