From 446f84861cdd2a72c8f3b0f2378ec3ca0c590d73 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Mon, 10 Jun 2024 21:56:26 +0200 Subject: [PATCH] Add Vec2, Vec2i, Vec3 and Vec3i classes --- .../sosengine/base/classes/Vec2.java | 69 +++++++++++++++ .../sosengine/base/classes/Vec2i.java | 69 +++++++++++++++ .../sosengine/base/classes/Vec3.java | 84 +++++++++++++++++++ .../sosengine/base/classes/Vec3i.java | 84 +++++++++++++++++++ 4 files changed, 306 insertions(+) create mode 100644 base/src/main/java/de/staropensource/sosengine/base/classes/Vec2.java create mode 100644 base/src/main/java/de/staropensource/sosengine/base/classes/Vec2i.java create mode 100644 base/src/main/java/de/staropensource/sosengine/base/classes/Vec3.java create mode 100644 base/src/main/java/de/staropensource/sosengine/base/classes/Vec3i.java diff --git a/base/src/main/java/de/staropensource/sosengine/base/classes/Vec2.java b/base/src/main/java/de/staropensource/sosengine/base/classes/Vec2.java new file mode 100644 index 00000000..5eb79667 --- /dev/null +++ b/base/src/main/java/de/staropensource/sosengine/base/classes/Vec2.java @@ -0,0 +1,69 @@ +/* + * STAROPENSOURCE ENGINE SOURCE FILE + * Copyright (c) 2024 The StarOpenSource Engine Contributors + * Licensed under the GNU Affero General Public License v3 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.staropensource.sosengine.base.classes; + +import lombok.Getter; + +/** + * Represents a 2D float Vector. + * + * @since 1-alpha0 + */ +@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" }) +@Getter +public class Vec2 { + /** + * The X axis value. + * + * @since 1-alpha0 + * + * -- GETTER -- + * Returns the X axis value. + * + * @return the X axis value + * @since 1-alpha0 + */ + private float x; + + /** + * The Y axis value. + * + * @since 1-alpha0 + * + * -- GETTER -- + * Returns the Y axis value. + * + * @return the Y axis value + * @since 1-alpha0 + */ + private float y; + + /** + * Constructor. + * + * @param x the X axis value + * @param y the Y axis value + * @since 1-alpha0 + */ + public Vec2(float x, float y) { + this.x = x; + this.y = y; + } +} diff --git a/base/src/main/java/de/staropensource/sosengine/base/classes/Vec2i.java b/base/src/main/java/de/staropensource/sosengine/base/classes/Vec2i.java new file mode 100644 index 00000000..348205ce --- /dev/null +++ b/base/src/main/java/de/staropensource/sosengine/base/classes/Vec2i.java @@ -0,0 +1,69 @@ +/* + * STAROPENSOURCE ENGINE SOURCE FILE + * Copyright (c) 2024 The StarOpenSource Engine Contributors + * Licensed under the GNU Affero General Public License v3 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.staropensource.sosengine.base.classes; + +import lombok.Getter; + +/** + * Represents a 2D integer Vector. + * + * @since 1-alpha0 + */ +@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" }) +@Getter +public class Vec2i { + /** + * The X axis value. + * + * @since 1-alpha0 + * + * -- GETTER -- + * Returns the X axis value. + * + * @return the X axis value + * @since 1-alpha0 + */ + private int x; + + /** + * The Y axis value. + * + * @since 1-alpha0 + * + * -- GETTER -- + * Returns the Y axis value. + * + * @return the Y axis value + * @since 1-alpha0 + */ + private int y; + + /** + * Constructor. + * + * @param x the X axis value + * @param y the Y axis value + * @since 1-alpha0 + */ + public Vec2i(int x, int y) { + this.x = x; + this.y = y; + } +} diff --git a/base/src/main/java/de/staropensource/sosengine/base/classes/Vec3.java b/base/src/main/java/de/staropensource/sosengine/base/classes/Vec3.java new file mode 100644 index 00000000..a91485e6 --- /dev/null +++ b/base/src/main/java/de/staropensource/sosengine/base/classes/Vec3.java @@ -0,0 +1,84 @@ +/* + * STAROPENSOURCE ENGINE SOURCE FILE + * Copyright (c) 2024 The StarOpenSource Engine Contributors + * Licensed under the GNU Affero General Public License v3 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.staropensource.sosengine.base.classes; + +import lombok.Getter; + +/** + * Represents a 3D float Vector. + * + * @since 1-alpha0 + */ +@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" }) +@Getter +public class Vec3 { + /** + * The X axis value. + * + * @since 1-alpha0 + * + * -- GETTER -- + * Returns the X axis value. + * + * @return the X axis value + * @since 1-alpha0 + */ + private float x; + + /** + * The Y axis value. + * + * @since 1-alpha0 + * + * -- GETTER -- + * Returns the Y axis value. + * + * @return the Y axis value + * @since 1-alpha0 + */ + private float y; + + /** + * The Z axis value. + * + * @since 1-alpha0 + * + * -- GETTER -- + * Returns the Z axis value. + * + * @return the Z axis value + * @since 1-alpha0 + */ + private float z; + + /** + * Constructor. + * + * @param x the X axis value + * @param y the Y axis value + * @param z the Z axis value + * @since 1-alpha0 + */ + public Vec3(float x, float y, float z) { + this.x = x; + this.y = y; + this.z = z; + } +} diff --git a/base/src/main/java/de/staropensource/sosengine/base/classes/Vec3i.java b/base/src/main/java/de/staropensource/sosengine/base/classes/Vec3i.java new file mode 100644 index 00000000..32e2a508 --- /dev/null +++ b/base/src/main/java/de/staropensource/sosengine/base/classes/Vec3i.java @@ -0,0 +1,84 @@ +/* + * STAROPENSOURCE ENGINE SOURCE FILE + * Copyright (c) 2024 The StarOpenSource Engine Contributors + * Licensed under the GNU Affero General Public License v3 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.staropensource.sosengine.base.classes; + +import lombok.Getter; + +/** + * Represents a 3D integer Vector. + * + * @since 1-alpha0 + */ +@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" }) +@Getter +public class Vec3i { + /** + * The X axis value. + * + * @since 1-alpha0 + * + * -- GETTER -- + * Returns the X axis value. + * + * @return the X axis value + * @since 1-alpha0 + */ + private int x; + + /** + * The Y axis value. + * + * @since 1-alpha0 + * + * -- GETTER -- + * Returns the Y axis value. + * + * @return the Y axis value + * @since 1-alpha0 + */ + private int y; + + /** + * The Z axis value. + * + * @since 1-alpha0 + * + * -- GETTER -- + * Returns the Z axis value. + * + * @return the Z axis value + * @since 1-alpha0 + */ + private int z; + + /** + * Constructor. + * + * @param x the X axis value + * @param y the Y axis value + * @param z the Z axis value + * @since 1-alpha0 + */ + public Vec3i(int x, int y, int z) { + this.x = x; + this.y = y; + this.z = z; + } +}