All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yungnickyoung.minecraft.yungsapi.math.Vector2f Maven / Gradle / Ivy

There is a newer version: 1.21.1-NeoForge-5.1.2
Show newest version
package com.yungnickyoung.minecraft.yungsapi.math;

public class Vector2f {
    public float x, y;

    public Vector2f(float x, float y) {
        this.x = x;
        this.y = y;
    }

    public Vector2f(float[] v) {
        this(v[0], v[1]);
    }

    public Vector2f(Vector2f v1) {
        this(v1.x, v1.y);
    }

    public final float dot(Vector2f v1) {
        return this.x * v1.x + this.y * v1.y;
    }

    public final float length() {
        return (float) Math.sqrt(this.x * this.x + this.y * this.y);
    }

    public final float lengthSquared() {
        return (this.x*this.x + this.y*this.y);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy