Skip to content

Commit

Permalink
Improve Vec2 and Vec4 constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
Reco1I committed Dec 28, 2024
1 parent 6c1a2af commit ee7b195
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/com/reco1l/framework/math/Vec2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 9 additions & 4 deletions src/com/reco1l/framework/math/Vec4.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ee7b195

Please sign in to comment.