Example #1
0
        /// <summary>Turns this vector into a normalized vector (vector with a length of 1) from the
        /// current vector. Will not work properly if the vector has a length of zero.</summary>
        /// <returns>The normalized (length of 1) vector!</returns>
        public void Normalize()
        {
            float mag = SKMath.Sqrt(x * x + y * y);

            x /= mag;
            y /= mag;
        }
Example #2
0
        /// <summary>Creates a normalized vector (vector with a length of 1) from the
        /// current vector. Will not work properly if the vector has a length of zero.</summary>
        /// <returns>The normalized (length of 1) vector!</returns>
        public Vec3 Normalized()
        {
            float mag = SKMath.Sqrt(x * x + y * y + z * z);

            return(new Vec3(x / mag, y / mag, z / mag));
        }
Example #3
0
        /// <summary>Creates a normalized vector (vector with a length of 1) from the
        /// current vector. Will not work properly if the vector has a length of zero.</summary>
        /// <returns>The normalized (length of 1) vector!</returns>
        public Vec2 Normalized()
        {
            float mag = SKMath.Sqrt(x * x + y * y);

            return(new Vec2(x / mag, y / mag));
        }