public int Manhattan(V2I v) { var disX = v.Col - Col; var disY = v.Row - Row; return((disX < 0 ? -disX : disX) + (disY < 0 ? -disY : disY)); }
double DistanceFromPointToLine(V2I point, V2I pointA, V2I pointB) { var v1 = pointB - pointA; var v2 = point - pointA; int dist = v1.Cross(v2) / v1.magnitude; return(UnityEngine.Mathf.Abs(dist)); }
public int Cross(V2I v) { return(x * v.y - y * v.x); }
public int Dot(V2I v) { return(x * v.x + y * v.y); }
public int Cross(V2I v) { return(Col * v.Row - Row * v.Col); }
public int Dot(V2I v) { return(Col * v.Col + Row * v.Row); }