I’m parsing transform skewX and skewY to output skew-angle and skew-length – both in degrees.
What I have is this:
const handleSkew = ({
skewX,
skewY,
}: Readonly<{ skewX: number, skewY: number }>) => {
const angle = rad2Deg(Math.atan2(skewY, skewX))
let length = rad2Deg(Math.sqrt(Math.pow(skewX, 2) + Math.pow(skewY, 2)))
if (skewX > 0 || skewY < 0) {
length = -length
}
return { length, angle }
}
const rad2Deg = (rad: number) => {
return (rad * 180.0) / Math.PI
}
This gives me correct direction and angle of skew, but length is slightly off. Can anybody tell be what I’m doing wrong here? ????