// Distance between this and aB public double DistBetweenPoints(Vect2D aB) { double xd = m_X - aB.m_X; double yd = m_Y - aB.m_Y; return(Math.Sqrt(xd * xd + yd * yd)); }
// this = this * aB public void CoMultTo(Vect2D aB) { double Xres, Yres; Xres = m_X * aB.m_X - m_Y * aB.m_Y; Yres = m_X * aB.m_Y + m_Y * aB.m_X; m_X = Xres; m_Y = Yres; }
// Vector from aP1 to aP2 public static Vect2D Create(Vect2D aP1, Vect2D aP2) { Vect2D v1; v1.m_X = aP2.X - aP1.X; v1.m_Y = aP2.Y - aP1.Y; return(v1); }
public Vect2D Add(Vect2D aVect) { Vect2D sum; sum.m_X = m_X + aVect.m_X; sum.m_Y = m_Y + aVect.m_Y; return(sum); }
// Complex Mult = rot this by aB public Vect2D CoMult(Vect2D aB) { Vect2D v1; double Xres, Yres; Xres = m_X * aB.m_X - m_Y * aB.m_Y; Yres = m_X * aB.m_Y + m_Y * aB.m_X; v1.m_X = Xres; v1.m_Y = Yres; return(v1); }
public double DiffAngle(Vect2D aB) { double ang = this.GetPhiGrad() - aB.GetPhiGrad(); double ret; ret = ang; if (ang > 180) { ret = -360 + ang; } if (ang < -180) { ret = 360 + ang; } return(ret); }
public static Vect2D Create(double aX, double aY, bool aPolar) { Vect2D v = Vect2D.ini; if (!aPolar) { v.m_X = aX; v.m_Y = aY; } else { // v.m_X = aX * Math.Cos(GRAD_RAD * aY); // v.m_Y = aX * Math.Sin(GRAD_RAD * aY); v.SetFrom_R_Phi(aX, aY); } return(v); }
public void Assign(Vect2D aVect) { m_X = aVect.m_X; m_Y = aVect.m_Y; }
public double ScalarProd(Vect2D aB) { return(m_X * aB.m_X + m_Y * aB.m_Y); }
// Distance between this and aB public double DistBetweenPoints(Vect2D aB) { double xd = m_X - aB.m_X; double yd = m_Y - aB.m_Y; return Math.Sqrt(xd * xd + yd * yd); }
// this vector with Length aLenght public Vect2D GetScaledVersion(double aLenght) { m_tmp = GetNormalizedVersion(); m_tmp = m_tmp.ScalarMult(aLenght); return m_tmp; }
public void SubFrom(Vect2D aVect) { m_X = m_X - aVect.m_X; m_Y = m_Y - aVect.m_Y; }
// this = this + aVect*aFactor public void AddTo(Vect2D aVect, double aFactor) { m_X = m_X + aVect.m_X * aFactor; m_Y = m_Y + aVect.m_Y * aFactor; }
// this = this + aVect public void AddTo(Vect2D aVect) { m_X = m_X + aVect.m_X; m_Y = m_Y + aVect.m_Y; }
// Complex Mult = rot this by aB public Vect2D CoMult(Vect2D aB) { double Xres, Yres; Xres = m_X * aB.m_X - m_Y * aB.m_Y; Yres = m_X * aB.m_Y + m_Y * aB.m_X; m_tmp.m_X = Xres; m_tmp.m_Y = Yres; return m_tmp; }
public Vect2D Add(Vect2D aVect) { m_tmp.m_X = m_X + aVect.m_X; m_tmp.m_Y = m_Y + aVect.m_Y; return m_tmp; }
// Vector from aP1 to aP2 public static Vect2D VectBetweenPoints(Vect2D aP1, Vect2D aP2) { m_tmp.X = aP2.X - aP1.X; m_tmp.Y = aP2.Y - aP1.Y; return m_tmp; }