//  implementation for My3Vector
//  My3Vector.cpp
//
#include <iostream> // pre-prozessor command 
#include <cmath> // pre-prozessor command 
#include "My3Vector.h"  // include declaration of class

using namespace std; // declare namespace

My3Vector::My3Vector() { // default constructor
  x = 0.; y = 0.; z = 0.; // set coords to 0.
}
My3Vector::My3Vector( double c1, double c2, double c3 ) {
  x = c1; y = c2; z = c3; // take args for coords
}
// get length of vector
double My3Vector::Length() {  
  return( sqrt( x*x + y*y +z*z ) );
}
// access elements
double My3Vector::X() { return x; }
double My3Vector::Y() { return y; }
double My3Vector::Z() { return z; }
// add
My3Vector My3Vector::Add( My3Vector & p ) {
  My3Vector t; 
  t.x = x + p.x;   t.y = y + p.y;   t.z = z + p.z;
  return( t );
}
// add
void My3Vector::Print( ) {
  cout << "( " << x << ", " << y << ", " << z << " )" << endl;
}