Compare commits

..

2 Commits

Author SHA1 Message Date
Dani The Skunk 77ef6a6e56 added Vec2f and Vec2i 2022-09-14 05:44:38 +02:00
Dani The Skunk 0d13c30983 no spaces before ( 2022-09-14 02:25:17 +02:00
3 changed files with 84 additions and 0 deletions

View File

@ -1,6 +1,13 @@
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173"> <code_scheme name="Project" version="173">
<codeStyleSettings language="JAVA"> <codeStyleSettings language="JAVA">
<option name="SPACE_BEFORE_IF_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_WHILE_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_FOR_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_TRY_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_CATCH_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_SWITCH_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_SYNCHRONIZED_PARENTHESES" value="false" />
<option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" /> <option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" /> <option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<indentOptions> <indentOptions>

View File

@ -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);
}
}

View File

@ -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);
}
}