title: Generating Catmull Rom spline and returning garbage
body: <p>After creating my Catmull Rom Spline such as:</p>
  
  <pre><code>vector3 SplineVector = newSpline.createCatmulRomSpline(vectorOne, vectorTwo, vectorThree, vectorFour, i);
  </code></pre>
  
  <p>However, when I read out the result from </p>
  
  <pre><code>vector3 SplineVector
  </code></pre>
  
  <p>I get garbage values.</p>
  
  <p>Here is a listing of my spline class, a segment of my vector3 class and in the implementation within the initialization.</p>
  
  <p><strong>initialization:</strong></p>
  
  <pre><code>for(float i = 0.0f; i &lt;= 1.0f; i += 0.1f)
      {
          vector3 SplineVector = newSpline.createCatmulRomSpline(vectorOne, vectorTwo, vectorThree, vectorFour, i);
          cout &lt;&lt; "\n\ncurve pos X: " &lt;&lt; SplineVector.getx();
          cout &lt;&lt; "\ncurve pos Y: " &lt;&lt; SplineVector.gety();
          cout &lt;&lt; "\ncurve pos Z: " &lt;&lt; SplineVector.getz();
  
      }
  </code></pre>
  
  <p><strong>Vector3:</strong></p>
  
  <pre><code>   class vector3
     {
      public:
  vector3::vector3():x(0),y(0),z(0)
  {
  }
  vector3::~vector3()
  {
  }
  
  vector3(float);
  vector3(float inx,float iny,float inz): x(inx), y(iny), z(inz)
  {   
  }
  
  //Vector operators
  _inline vector3 operator=(const vector3&amp; invec){ // Assignment
      return vector3(this-&gt;x=invec.x,this-&gt;y=invec.y,this-&gt;z=invec.z);
  }   
  
  _inline vector3 operator+(const vector3&amp; invec){//Addition
      return vector3(this-&gt;x+invec.x,this-&gt;y+invec.y,this-&gt;z+invec.z);
  }
  _inline vector3 operator-(const vector3&amp; invec){//Subtraction
      return vector3(this-&gt;x-invec.x,this-&gt;y-invec.y,this-&gt;z-invec.z);
  }
  
  _inline vector3 operator*(const vector3&amp; invec){//Multiplication
      return vector3(this-&gt;x*invec.x,this-&gt;y*invec.y,this-&gt;z*invec.z);
  }
  _inline vector3 operator/(const vector3&amp; invec){//Division
      return vector3(this-&gt;x/invec.x,this-&gt;y/invec.y,this-&gt;z/invec.z);
  }
  
  //Scaler operators
  _inline vector3&amp; operator+=(const float&amp; scaler){//Addition self-assignment
      return vector3(this-&gt;x+=scaler,this-&gt;y+=scaler,this-&gt;z+=scaler);
  }
  _inline vector3&amp; operator-=(const float&amp; scaler){//Subtraction self-assignment
      return vector3(this-&gt;x-=scaler,this-&gt;y-=scaler,this-&gt;z-=scaler);
  }
  _inline vector3&amp; operator*=(const float&amp; scaler){//Multiplication self-assignment
      return vector3(this-&gt;x*=scaler,this-&gt;y*=scaler,this-&gt;z*=scaler);
  }
  _inline vector3&amp; operator*(const float&amp; scalar){
      return vector3(this-&gt;x*scalar, this-&gt;y*scalar, this-&gt;z*scalar);
  }
  
  //Math methods
  _inline vector3 operator^(vector3&amp; invec){//Cross product
      return vector3( (this-&gt;y*invec.z-this-&gt;z*invec.y),
                      (this-&gt;z*invec.x-this-&gt;x*invec.z),
                      (this-&gt;x*invec.y-this-&gt;y*invec.x));
  }
  _inline vector3 operator&amp;(vector3&amp; invec){//Dot product
      return (this-&gt;x*invec.x)+(this-&gt;y*invec.y)+(this-&gt;z*invec.z);
  }
  _inline vector3 distance(vector3&amp;);//Distance
  
  _inline void normalize(){
      float mag = sqrtf(this-&gt;x*this-&gt;x+this-&gt;y*this-&gt;y+this-&gt;z*this-&gt;z);
      this-&gt;x/=mag;
      this-&gt;y/=mag;
      this-&gt;z/=mag;
  }
  
  float x;
  float y;
  float z;
  
  float getx();
  float gety();
  float getz();
  float getMagnitude();
       private:
  
    float mag;
   };
  </code></pre>
  
  <p><strong>Catmull Rom Spline Generation</strong></p>
  
  <pre><code>_inline vector3 createCatmulRomSpline(vector3 P0, vector3 P1, vector3 P2, vector3 P3, float t)
  {
  
      float t2 = t*t;
      float t3 = t2*t;
  
      vector3 result = ((P1*2) + (P2 - P0) * t + (P0*2 - P1 * 5 + P2*4 - P3)*t2 + (P1*3 - P0- P2*3 + P3) * t3)*0.5f;
      return result;
  }
  </code></pre>
  
  <p>I have tried other peoples code and when it comes to outputting the data into the final vector, it outputs bogus values. </p>