Skip to content

Add rotation angle calculation from affine transform array as matrix utils. #2

@softmarshmallow

Description

@softmarshmallow

The 2d space rotation angle extraction function is below. Add this to matrix utils.

function angleFromTransform(transform: Readonly<Transform>): number {
  try {
    const [a, b, c] = transform[0];
    const [d, e, f] = transform[1];
    var angle = Math.round(Math.atan2(b, a) * (180 / Math.PI));
    return angle < 0 ? angle + 360 : angle;
  } catch (e) {
    console.error(e);
    return 0;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions