示例#1
0
        public FixedPointVector2 NormalizeWithClampedMagnitude(FixedPoint clamp)
        {
            var magnitude = MathFixedPoint.ClampMagnitude(this, clamp);

            if (magnitude > FixedPoint.Zero)
            {
                return(this / magnitude);
            }

            return(this);
        }
示例#2
0
        public FixedPointVector2 Normalize()
        {
            var magnitude = MathFixedPoint.Magnitude(this);

            if (magnitude.Equals(FixedPoint.Zero))
            {
                return(Sign());
            }

            return(this / magnitude);
        }
示例#3
0
 public static FixedPoint Distance(FixedPointVector2 v1, FixedPointVector2 v2)
 {
     return(MathFixedPoint.Sqrt(((v1.X - v2.X) ^ FixedPoint.Two) + ((v1.Y - v2.Y) ^ FixedPoint.Two)));
 }
示例#4
0
 public FixedPoint Length()
 {
     return(MathFixedPoint.Magnitude(this));
 }
示例#5
0
 public FixedPointVector2 Sign()
 {
     return(new FixedPointVector2(MathFixedPoint.Sign(X), MathFixedPoint.Sign(Y)));
 }