From ee7b195ef0d5b4c756399f9c87d71a0c1719ad6a Mon Sep 17 00:00:00 2001 From: Geronimo Ferruccio Date: Fri, 27 Dec 2024 22:23:59 -0300 Subject: [PATCH] Improve Vec2 and Vec4 constructors --- src/com/reco1l/framework/math/Vec2.kt | 7 +++++-- src/com/reco1l/framework/math/Vec4.kt | 13 +++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/com/reco1l/framework/math/Vec2.kt b/src/com/reco1l/framework/math/Vec2.kt index fe303f071..283e30167 100644 --- a/src/com/reco1l/framework/math/Vec2.kt +++ b/src/com/reco1l/framework/math/Vec2.kt @@ -2,12 +2,15 @@ package com.reco1l.framework.math data class Vec2( - val x: Float = 0f, + val x: Float, - val y: Float = 0f, + val y: Float, ) { + constructor(value: Float = 0f) : this(value, value) + + val total get() = x + y diff --git a/src/com/reco1l/framework/math/Vec4.kt b/src/com/reco1l/framework/math/Vec4.kt index 675c25b49..a4b11dade 100644 --- a/src/com/reco1l/framework/math/Vec4.kt +++ b/src/com/reco1l/framework/math/Vec4.kt @@ -2,13 +2,18 @@ package com.reco1l.framework.math data class Vec4( - val x: Float = 0f, - val y: Float = 0f, - val z: Float = 0f, - val w: Float = 0f, + val x: Float, + val y: Float, + val z: Float, + val w: Float, ) { + constructor(value: Float = 0f) : this(value, value, value, value) + + constructor(xz: Float, yw: Float) : this(xz, yw, xz, yw) + + val left: Float get() = x