[DEV] add feature
This commit is contained in:
parent
3270d4608d
commit
465277690a
@ -1,7 +1,5 @@
|
|||||||
package org.atriasoft.etk.math;
|
package org.atriasoft.etk.math;
|
||||||
|
|
||||||
import org.atriasoft.etk.Uri;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -11,6 +9,7 @@ public record Vector2f(
|
|||||||
float x,
|
float x,
|
||||||
float y) {
|
float y) {
|
||||||
final static Logger LOGGER = LoggerFactory.getLogger(Vector2f.class);
|
final static Logger LOGGER = LoggerFactory.getLogger(Vector2f.class);
|
||||||
|
|
||||||
public static Vector2f valueOf(String value) {
|
public static Vector2f valueOf(String value) {
|
||||||
float val1 = 0;
|
float val1 = 0;
|
||||||
float val2 = 0;
|
float val2 = 0;
|
||||||
@ -40,7 +39,17 @@ public record Vector2f(
|
|||||||
/*
|
/*
|
||||||
* **************************************************** Constructor
|
* **************************************************** 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
|
@CheckReturnValue
|
||||||
public static Vector2f clipInt(final Vector2f obj1) {
|
public static Vector2f clipInt(final Vector2f obj1) {
|
||||||
return new Vector2f((int) obj1.x, (int) obj1.y);
|
return new Vector2f((int) obj1.x, (int) obj1.y);
|
||||||
|
@ -48,6 +48,9 @@ public record Vector2i(
|
|||||||
this.y = y;
|
this.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector2f toVector2f() {
|
||||||
|
return new Vector2f(this.x, this.y);
|
||||||
|
}
|
||||||
public static Vector2i max(final Vector2i obj1, final Vector2i obj2) {
|
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));
|
return new Vector2i(Math.max(obj1.x, obj2.x), Math.max(obj1.y, obj2.y));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user