Add Vec2, Vec2i, Vec3 and Vec3i classes
This commit is contained in:
parent
52e0f67bd2
commit
446f84861c
4 changed files with 306 additions and 0 deletions
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue