<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace ExtensionMethods {
    public static class ExtensionMethods {
        // Returns a Vector2 with the X and Y component of the current Vector3
        public static Vector2 ToVector2(this Vector3 vector) {
            Vector2 ret = new Vector2(vector.X, vector.Y);
            return ret;
        }

        // Returns a Vector3 with components [X, Y, 0] from the current Vector2 
        public static Vector3 ToVector3(this Vector2 vector) {
            Vector3 ret = new Vector3(vector, 0);
            return ret;
        }

        // Returns a Vector3 with components [X, Y, 0] from the current Point
        public static Vector3 ToVector3(this Point point) {
            return new Vector3(point.X, point.Y, 0);
        }

        public static float Angle(this Vector3 vector) {
            throw new NotImplementedException();
            return 0f;
        }

    }
}<commit_msg>Implemented Vector2.Angle()<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace ExtensionMethods {
    public static class ExtensionMethods {
        // Returns a Vector2 with the X and Y component of the current Vector3
        public static Vector2 ToVector2(this Vector3 vector) {
            Vector2 ret = new Vector2(vector.X, vector.Y);
            return ret;
        }

        // Returns a Vector3 with components [X, Y, 0] from the current Vector2 
        public static Vector3 ToVector3(this Vector2 vector) {
            Vector3 ret = new Vector3(vector, 0);
            return ret;
        }

        // Returns a Vector3 with components [X, Y, 0] from the current Point
        public static Vector3 ToVector3(this Point point) {
            return new Vector3(point.X, point.Y, 0);
        }

        /// <summary>
        /// Calculates the angle of the vector with respect to the x-axis
        /// </summary>
        /// <param name="vector"></param>
        /// <returns></returns>
        public static float Angle(this Vector2 vector) {
            if (vector == Vector2.Zero)
                return 0f;
            float angle = (float)Math.Atan(vector.Y / vector.X);
            if (Math.Sign(vector.X) < 0)
                angle += MathHelper.Pi;
            return angle;
        }

    }
}
{'fraction_non_alphanumeric': 0.08611111111111111, 'fraction_numerical': 0.02023809523809524, 'mean_word_length': 2.100861008610086, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2632283', 'n_tokens_mistral': 687, 'n_tokens_neox': 664, 'n_words': 234}