title: mapping x,y,z Coordinates into screen coordinates or projection coordinates in Kinect to XNA
body: <p>I have written a program to record the joint values of the Skeleton . . basically RightHand.joint to get the X, Y , Z coordinates from the Sensor, now i want to use these values to animate my 3D model .. somehow i have gotten the formula to convert the x,y values to the real world projection but don't understand how to do that with the Z coordinate.. Also i dont understand why we need to do the following</p>
  
  <pre><code> int x = (int) Math.Floor(((float.Parse(temp[0]) * 0.5f) + 0.5f) * maxWidth);
   int y = (int) Math.Floor(((float.Parse(temp[1]) * -0.5f) + 0.5f) * maxHeight);
  </code></pre>
  
  <p>Isnt it sufficient to just multiply the x and y values by the screen width &amp; height instead of doing *0.5f (+0.5f) . . If someone could explain it would be very helpful and also how to get the Z coordinates?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>      protected override void Update(GameTime gameTime)
          {
               //// TODO: Add your update logic here
              using (StreamReader r = new StreamReader(f))
              {
                  string line;
                  Viewport view = graphics.GraphicsDevice.Viewport;
                  int maxWidth = view.Width;
                  int maxHeight = view.Height;
  
                  while ((line = r.ReadLine()) != null)
                  {
                      string[] temp = line.Split(',');
  
        int x = (int)Math.Floor(((float.Parse(temp[0]) * 0.5f) + 0.5f) * maxWidth);
        int y = (int)Math.Floor(((float.Parse(temp[1]) * -0.5f) + 0.5f) * maxHeight);
  
         //Wrong Z - value Cal (Testing)
         int z = (int)Math.Floor(((float.Parse(temp[2])* 0.5) + 0.5f) * maxHeight);
  
                   motion_z.Add(new Point3D(x, y, z));
  
               }
           }
  
               ModelPosition.X = (float)(motion_z[i].X);
               ModelPosition.Y = (float)(motion_z[i].Y);
               ModelPosition.Z = (float)(motion_z[i].Z);
  
               i++;
            base.Update(gameTime);
         }
  </code></pre>