Skip to content

[geometry-1] discrepancy: setting a matrix to identity with setters keeps is2D true. Creating a matrix with an identity sequence sets is2D to false. #588

@trusktr

Description

@trusktr

There's a discrepancy:

This,

const mat = new DOMMatrix()
toIdentity(mat)
console.log(mat.is2D) // "true"

function toIdentity(mat) {
	mat.m11 = 1
	mat.m12 = 0
	mat.m13 = 0
	mat.m14 = 0

	mat.m21 = 0
	mat.m22 = 1
	mat.m23 = 0
	mat.m24 = 0

	mat.m31 = 0
	mat.m32 = 0
	mat.m33 = 1
	mat.m34 = 0

	mat.m41 = 0
	mat.m42 = 0
	mat.m43 = 0
	mat.m44 = 1
}

is essentially the same as the following,

const mat = new DOMMatrix([
  1, 0, 0, 0,
  0, 1 ,0, 0,
  0, 0, 1, 0,
  0, 0, 0, 1
])
console.log(mat.is2D) // "false"

except is2D is false instead of true in the second one.

I believe that if a matrix is set back to identity in any way, is2D should return true.

Related:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions