Unverified Commit e41633e8 authored by Oleksandr Karpovich's avatar Oleksandr Karpovich Committed by GitHub

remove `*floatArray(...)` calls when values passed into Matrix33 as vararg (#466)

Co-authored-by: 's avatarOleksandr Karpovich <oleksandr.karpovich@jetbrains.com>
parent 3c5a878b
...@@ -43,7 +43,6 @@ class Matrix33(vararg mat: Float) { ...@@ -43,7 +43,6 @@ class Matrix33(vararg mat: Float) {
val mat: FloatArray val mat: FloatArray
fun makePreScale(sx: Float, sy: Float): Matrix33 { fun makePreScale(sx: Float, sy: Float): Matrix33 {
return Matrix33( return Matrix33(
*floatArrayOf(
mat[0] * sx, mat[0] * sx,
mat[1] * sy, mat[1] * sy,
mat[2], mat[2],
...@@ -54,7 +53,6 @@ class Matrix33(vararg mat: Float) { ...@@ -54,7 +53,6 @@ class Matrix33(vararg mat: Float) {
mat[7] * sy, mat[7] * sy,
mat[8] mat[8]
) )
)
} }
/** /**
...@@ -84,7 +82,6 @@ class Matrix33(vararg mat: Float) { ...@@ -84,7 +82,6 @@ class Matrix33(vararg mat: Float) {
*/ */
fun makeConcat(other: Matrix33): Matrix33 { fun makeConcat(other: Matrix33): Matrix33 {
return Matrix33( return Matrix33(
*floatArrayOf(
mat[0] * other.mat[0] + mat[1] * other.mat[3] + mat[2] * other.mat[6], mat[0] * other.mat[0] + mat[1] * other.mat[3] + mat[2] * other.mat[6],
mat[0] * other.mat[1] + mat[1] * other.mat[4] + mat[2] * other.mat[7], mat[0] * other.mat[1] + mat[1] * other.mat[4] + mat[2] * other.mat[7],
mat[0] * other.mat[2] + mat[1] * other.mat[5] + mat[2] * other.mat[8], mat[0] * other.mat[2] + mat[1] * other.mat[5] + mat[2] * other.mat[8],
...@@ -95,7 +92,6 @@ class Matrix33(vararg mat: Float) { ...@@ -95,7 +92,6 @@ class Matrix33(vararg mat: Float) {
mat[6] * other.mat[1] + mat[7] * other.mat[4] + mat[8] * other.mat[7], mat[6] * other.mat[1] + mat[7] * other.mat[4] + mat[8] * other.mat[7],
mat[6] * other.mat[2] + mat[7] * other.mat[5] + mat[8] * other.mat[8] mat[6] * other.mat[2] + mat[7] * other.mat[5] + mat[8] * other.mat[8]
) )
)
} }
/** /**
...@@ -158,7 +154,7 @@ class Matrix33(vararg mat: Float) { ...@@ -158,7 +154,7 @@ class Matrix33(vararg mat: Float) {
* @return Matrix33 with translation * @return Matrix33 with translation
*/ */
fun makeTranslate(dx: Float, dy: Float): Matrix33 { fun makeTranslate(dx: Float, dy: Float): Matrix33 {
return Matrix33(*floatArrayOf(1f, 0f, dx, 0f, 1f, dy, 0f, 0f, 1f)) return Matrix33(1f, 0f, dx, 0f, 1f, dy, 0f, 0f, 1f)
} }
/** /**
...@@ -193,7 +189,7 @@ class Matrix33(vararg mat: Float) { ...@@ -193,7 +189,7 @@ class Matrix33(vararg mat: Float) {
* @return Matrix33 with scale * @return Matrix33 with scale
*/ */
fun makeScale(sx: Float, sy: Float): Matrix33 { fun makeScale(sx: Float, sy: Float): Matrix33 {
return Matrix33(*floatArrayOf(sx, 0f, 0f, 0f, sy, 0f, 0f, 0f, 1f)) return Matrix33(sx, 0f, 0f, 0f, sy, 0f, 0f, 0f, 1f)
} }
/** /**
...@@ -210,7 +206,6 @@ class Matrix33(vararg mat: Float) { ...@@ -210,7 +206,6 @@ class Matrix33(vararg mat: Float) {
if (abs(sin) <= tolerance) sin = 0.0 if (abs(sin) <= tolerance) sin = 0.0
if (abs(cos) <= tolerance) cos = 0.0 if (abs(cos) <= tolerance) cos = 0.0
return Matrix33( return Matrix33(
*floatArrayOf(
cos.toFloat(), cos.toFloat(),
(-sin).toFloat(), (-sin).toFloat(),
0f, 0f,
...@@ -221,7 +216,6 @@ class Matrix33(vararg mat: Float) { ...@@ -221,7 +216,6 @@ class Matrix33(vararg mat: Float) {
0f, 0f,
1f 1f
) )
)
} }
/** /**
...@@ -251,7 +245,6 @@ class Matrix33(vararg mat: Float) { ...@@ -251,7 +245,6 @@ class Matrix33(vararg mat: Float) {
if (abs(sin) <= tolerance) sin = 0.0 if (abs(sin) <= tolerance) sin = 0.0
if (abs(cos) <= tolerance) cos = 0.0 if (abs(cos) <= tolerance) cos = 0.0
return Matrix33( return Matrix33(
*floatArrayOf(
cos.toFloat(), cos.toFloat(),
(-sin).toFloat(), (-sin).toFloat(),
(pivotx - pivotx * cos + pivoty * sin).toFloat(), (pivotx - pivotx * cos + pivoty * sin).toFloat(),
...@@ -262,7 +255,6 @@ class Matrix33(vararg mat: Float) { ...@@ -262,7 +255,6 @@ class Matrix33(vararg mat: Float) {
0f, 0f,
1f 1f
) )
)
} }
/** /**
...@@ -280,7 +272,7 @@ class Matrix33(vararg mat: Float) { ...@@ -280,7 +272,7 @@ class Matrix33(vararg mat: Float) {
* @return Matrix33 with skew * @return Matrix33 with skew
*/ */
fun makeSkew(sx: Float, sy: Float): Matrix33 { fun makeSkew(sx: Float, sy: Float): Matrix33 {
return Matrix33(*floatArrayOf(1f, sx, 0f, sy, 1f, 0f, 0f, 0f, 1f)) return Matrix33(1f, sx, 0f, sy, 1f, 0f, 0f, 0f, 1f)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment