/// <summary> /// returns the distance beteween the two vectors. Will always be positive.Same as minus(v).mag(). /// </summary> /// <param name="v"></param> /// <returns></returns> // Useful Functions public double dist(JJVector v) { var dx = mX - v.x(); var dy = mY - v.y(); return(Math.Sqrt(dx * dx + dy * dy)); }
public JJVector plus(JJVector v, JJVector result) { result.set(mX + v.x(), mY + v.y(), mT + v.t()); return(result); }
public JJVector minus(JJVector v, JJVector result) { result.set(mX - v.x(), mY - v.y(), mT - v.t()); return(result); }
/// <summary> /// /// </summary> /// <param name="v"></param> /// <returns>returns this . v, i.e. the dot product of this and v.</returns> public double dot(JJVector v) => mX *v.x() + mY * v.y();