<commit_before>/*
 * This file is part of the Turtle project
 *
 * (c) 2011 <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

package turtle.util;

/**
 * Gestion des vecteurs en deux dimensions
 *
 * @author <NAME> <<EMAIL>>
 * @since 1.0
 */
public class Vector2D implements Cloneable
{
    protected double mX;
    protected double mY;

    public Vector2D()
    {
        this(0, 0);
    }

    public Vector2D(double x, double y)
    {
        mX = x;
        mY = y;
    }

    public Vector2D(Vector2D vector)
    {
        mX = vector.mX;
        mY = vector.mY;
    }

    /**
     * Effectue une rotation du vecteur
     *
     * @param angle L'angle de rotation (en gradient)
     */
    public void rotate(double angle)
    {
        double rx = (mX * Math.cos(angle)) - (mY * Math.sin(angle));
        double ry = (mY * Math.sin(angle)) + (mY * Math.cos(angle));

        mX = rx;
        mY = ry;
    }

    /**
     * Retourne la norme du vecteur
     */
    public double norm()
    {
        return  Math.sqrt(mX * mX + mY * mY);
    }

    @Override
    public boolean equals(Object obj)
    {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Vector2D other = (Vector2D) obj;

        if (Double.doubleToLongBits(this.mX) != Double.doubleToLongBits(other.mX)) {
            return false;
        }
        if (Double.doubleToLongBits(this.mY) != Double.doubleToLongBits(other.mY)) {
            return false;
        }<commit_msg>fixed Vector2D rotation<commit_after>/*
 * This file is part of the Turtle project
 *
 * (c) 2011 <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

package turtle.util;

/**
 * Gestion des vecteurs en deux dimensions
 *
 * @author <NAME> <<EMAIL>>
 * @since 1.0
 */
public class Vector2D implements Cloneable
{
    protected double mX;
    protected double mY;

    public Vector2D()
    {
        this(0, 0);
    }

    public Vector2D(double x, double y)
    {
        mX = x;
        mY = y;
    }

    public Vector2D(Vector2D vector)
    {
        mX = vector.mX;
        mY = vector.mY;
    }

    /**
     * Effectue une rotation du vecteur
     *
     * @param angle L'angle de rotation (en gradient)
     */
    public void rotate(double angle)
    {
        double rx = (mX * Math.cos(angle)) - (mY * Math.sin(angle));
        double ry = (mY * Math.cos(angle)) + (mX * Math.sin(angle));

        mX = rx;
        mY = ry;
    }

    /**
     * Retourne la norme du vecteur
     */
    public double norm()
    {
        return  Math.sqrt(mX * mX + mY * mY);
    }

    @Override
    public boolean equals(Object obj)
    {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Vector2D other = (Vector2D) obj;

        if (Double.doubleToLongBits(this.mX) != Double.doubleToLongBits(other.mX)) {
            return false;
        }
        if (Double.doubleToLongBits(this.mY) != Double.doubleToLongBits(other.mY)) {
            return false;
        }
{'fraction_non_alphanumeric': 0.11846061334936861, 'fraction_numerical': 0.009320505111244739, 'mean_word_length': 1.8508997429305913, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '4202263', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1079, 'n_words': 304}