[DEV] add feature

This commit is contained in:
Edouard DUPIN 2025-07-14 16:30:45 +02:00
parent 3270d4608d
commit 465277690a
2 changed files with 15 additions and 3 deletions

View File

@ -1,7 +1,5 @@
package org.atriasoft.etk.math;
import org.atriasoft.etk.Uri;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -11,6 +9,7 @@ public record Vector2f(
float x,
float y) {
final static Logger LOGGER = LoggerFactory.getLogger(Vector2f.class);
public static Vector2f valueOf(String value) {
float val1 = 0;
float val2 = 0;
@ -40,7 +39,17 @@ public record Vector2f(
/*
* **************************************************** Constructor
*****************************************************/
@CheckReturnValue
public Vector2i toVector2i() {
return new Vector2i((int) this.x, (int) this.y);
}
@CheckReturnValue
public Vector3f toVector3f() {
return new Vector3f(this.x, this.y, 0);
}
@CheckReturnValue
public static Vector2f clipInt(final Vector2f obj1) {
return new Vector2f((int) obj1.x, (int) obj1.y);

View File

@ -48,6 +48,9 @@ public record Vector2i(
this.y = y;
}
public Vector2f toVector2f() {
return new Vector2f(this.x, this.y);
}
public static Vector2i max(final Vector2i obj1, final Vector2i obj2) {
return new Vector2i(Math.max(obj1.x, obj2.x), Math.max(obj1.y, obj2.y));
}