Skip to content

error in mat3.inverse(), and suggestion #18

Open
@davidjeck

Description

It seems like mat3.inverse() in version 2.4.0 actually computes the transpose of the inverse. mat4.inverse() is OK. I was trying to use gpu-matrix to compute a normal vector transformation matrix -- a mat3.normalMatrixFromMat4() function would be a good addition.

<script src="wgpu-matrix.js"></script> <script> let matrix = wgpuMatrix.mat3.create( 1,0,0, 0,1,0, 2,3,1 ); console.log( wgpuMatrix.mat3.multiply( matrix, wgpuMatrix.mat3.inverse(matrix) ) ); // does not output the identity matrix console.log( wgpuMatrix.mat3.multiply( matrix, wgpuMatrix.mat3.transpose(wgpuMatrix.mat3.inverse(matrix)) ) ); // outputs the identity matrix matrix = wgpuMatrix.mat4.create( 1,0,0,0, 0,1,0,0, 0,0,1,0, 2,3,4,1 ); console.log( wgpuMatrix.mat4.multiply( matrix, wgpuMatrix.mat4.inverse(matrix) ) ); // outputs the identity matrix </script>

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions