public IntVector2 Normalize() { double len = this.Length; var x = MyMath.Round(this.X / len); var y = MyMath.Round(this.Y / len); return(new IntVector2(x, y)); }
public Direction ToDirection() { DoubleVector3 v = Normalize(); int x = MyMath.Round(v.X); int y = MyMath.Round(v.Y); int z = MyMath.Round(v.Z); return(DirectionExtensions.ComponentsToDirection(x, y, z)); }
public IntVector2 Rotate(int angle) { double rad = Math.PI * angle / 180.0; double x = Math.Cos(rad) * this.X - Math.Sin(rad) * this.Y; double y = Math.Sin(rad) * this.X + Math.Cos(rad) * this.Y; var ix = MyMath.Round(x); var iy = MyMath.Round(y); return(new IntVector2(ix, iy)); }
public IntVector3 Normalize() { if (this.IsNull) { return(new IntVector3()); } double len = this.Length; var x = MyMath.Round(this.X / len); var y = MyMath.Round(this.Y / len); var z = MyMath.Round(this.Z / len); return(new IntVector3(x, y, z)); }
public IntVector3 ToIntVector3() { return(new IntVector3(MyMath.Round(this.X), MyMath.Round(this.Y), MyMath.Round(this.Z))); }
public DoubleVector3 Round() { return(new DoubleVector3(MyMath.Round(this.X), MyMath.Round(this.Y), MyMath.Round(this.Z))); }