Matrix3D::rotated()

I think the implementation of the Matrix3D::rotated() function is wrong.

/** Returns a copy of this matrix after rotation through the Y, X and then Z angles
        specified by the vector.
    */
    Matrix3D rotated (Vector3D<Type> eulerAngleRadians) const noexcept
    {
        const Type cx = std::cos (eulerAngleRadians.x),  sx = std::sin (eulerAngleRadians.x),
                   cy = std::cos (eulerAngleRadians.y),  sy = std::sin (eulerAngleRadians.y),
                   cz = std::cos (eulerAngleRadians.z),  sz = std::sin (eulerAngleRadians.z);

        return Matrix3D ((cy * cz) + (sx * sy * sz), cx * sz, (cy * sx * sz) - (cz * sy), 0.0f,
                         (cz * sx * sy) - (cy * sz), cx * cz, (cy * cz * sx) + (sy * sz), 0.0f,
                         cx * sy, -sx, cx * cy, 0.0f,
                         0.0f, 0.0f, 0.0f, 1.0f);
    }

As far as I can see this is not “returning a copy of this matrix after rotation” but rather returning a rotation matrix.

2 Likes

Hmm… Yes, well spotted! Will fix that!