package com.danitheskunk.skunkworks;

@SuppressWarnings("SpellCheckingInspection")
public final class Vec2i {
	public final static Vec2i ZERO = new Vec2i(0, 0);
	private final int x, y;

	//constructors

	public Vec2i(int x, int y) {
		this.x = x;
		this.y = y;
	}

	//getters and setters

	public static Vec2i add(Vec2i a, Vec2i b) {
		return new Vec2i(a.x + b.x, a.y + b.y);
	}

	public static Vec2i add(Vec2i a, Vec2i b, Vec2i c) {
		return new Vec2i(a.x + b.x + c.x, a.y + b.y + c.y);
	}

	//static functions

	public static Vec2i add(Vec2i a, Vec2i b, Vec2i c, Vec2i d) {
		return new Vec2i(a.x + b.x + c.x + d.x, a.y + b.y + c.y + d.y);
	}

	public static Vec2i div(Vec2i a, int b) {
		return new Vec2i(a.x / b, a.y / b);
	}

	public static Vec2i div(Vec2i a, Vec2i b) {
		return new Vec2i(a.x / b.x, a.y / b.y);
	}

	public static Vec2f divf(Vec2i a, double b) {
		return new Vec2f(a.x / b, a.y / b);
	}

	public static Vec2f divf(Vec2i a, Vec2f b) {
		return new Vec2f(a.x / b.getX(), a.y / b.getY());
	}

	public static Vec2f divf(Vec2i a, int b) {
		return new Vec2f(a.x / (double) b, a.y / (double) b);
	}

	public static Vec2f divf(Vec2i a, Vec2i b) {
		return new Vec2f(a.x / (double) b.x, a.y / (double) b.y);
	}

	public static Vec2i max(Vec2i a, Vec2i b) {
		return new Vec2i(Math.max(a.x, b.x), Math.max(a.y, b.y));
	}

	public static Vec2i min(Vec2i a, Vec2i b) {
		return new Vec2i(Math.min(a.x, b.x), Math.min(a.y, b.y));
	}

	public static Vec2i mul(Vec2i a, int b) {
		return new Vec2i(a.x * b, a.y * b);
	}

	public static Vec2i mul(Vec2i a, Vec2i b) {
		return new Vec2i(a.x * b.x, a.y * b.y);
	}

	public static Vec2i mul(Vec2f a, Vec2i b) {
		return new Vec2i((int) (a.getX() * b.getX()),
			(int) (a.getY() * b.getY())
		);
	}

	public static Vec2i mul(Vec2i a, double b) {
		return new Vec2i((int) (a.x / b), (int) (a.y / b));
	}

	public static Vec2i sub(Vec2i a, Vec2i b) {
		return new Vec2i(a.x - b.x, a.y - b.y);
	}

	public static Vec2i tween(Vec2i a, Vec2i b, double amount) {
		return new Vec2i(Util.tweenInt(a.x, b.x, amount),
			Util.tweenInt(a.y, b.y, amount)
		);
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	public Vec2f toVec2f() {
		return new Vec2f(x, y);
	}
}
