diff --git a/com/danitheskunk/skunkworks/Vec2f.java b/com/danitheskunk/skunkworks/Vec2f.java new file mode 100644 index 0000000..94f0645 --- /dev/null +++ b/com/danitheskunk/skunkworks/Vec2f.java @@ -0,0 +1,37 @@ +package com.danitheskunk.skunkworks; + +public final class Vec2f { + final double x, y; + + //constructors + public Vec2f(double x, double y) { + this.x = x; + this.y = y; + } + + //getters and setters + public double getX() { + return x; + } + + public double getY() { + return y; + } + + //static functions + public static Vec2f add(Vec2f a, Vec2f b) { + return new Vec2f(a.x + b.x, a.y + b.y); + } + + public static Vec2f sub(Vec2f a, Vec2f b) { + return new Vec2f(a.x - b.x, a.y - b.y); + } + + public static Vec2f mul(Vec2f a, double b) { + return new Vec2f(a.x * b, a.y * b); + } + + public static Vec2f div(Vec2f a, double b) { + return new Vec2f(a.x / b, a.y / b); + } +} diff --git a/com/danitheskunk/skunkworks/Vec2i.java b/com/danitheskunk/skunkworks/Vec2i.java new file mode 100644 index 0000000..0f16ec8 --- /dev/null +++ b/com/danitheskunk/skunkworks/Vec2i.java @@ -0,0 +1,40 @@ +package com.danitheskunk.skunkworks; + +public final class Vec2i { + final int x, y; + + //constructors + + public Vec2i(int x, int y) { + this.x = x; + this.y = y; + } + + //getters and setters + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + //static functions + + public static Vec2i add(Vec2i a, Vec2i b) { + return new Vec2i(a.x + b.x, a.y + b.y); + } + + public static Vec2i sub(Vec2i a, Vec2i b) { + return new Vec2i(a.x - b.x, a.y - b.y); + } + + public static Vec2i mul(Vec2i a, int b) { + return new Vec2i(a.x * b, a.y * b); + } + + public static Vec2i div(Vec2i a, int b) { + return new Vec2i(a.x / b, a.y / b); + } +}