/// @file /// @brief Task1: "single-file" excutable C++ program /// @todo Include standard library headers as needed #include // std::array #include #include namespace task1 { using Coord = std::array; /// @todo Implement a function 'rotate_counter_clockwise' according to the description below: /// - the function receives a two-dimensional coordinate in form of a 'std::array' /// - the function receives a rotation angle (in radians) in form of a 'double' /// - the function rotates the coordinate counter clockwise around the origin /// - the function returns the rotated coordinate as a std::array std::array rotate_counter_clockwise(const Coord& coord, double angle) { std::array rotated_coord = {0, 0}; rotated_coord[0] = coord[0] * cos(angle) - coord[1] * sin(angle); rotated_coord[1] = coord[0] * sin(angle) + coord[1] * cos(angle); return rotated_coord; } } // namespace task1 /// @todo Implement a main function conducting the following tasks in this order: /// - Create two coordinates (local variables): /// - std::array coord1 = {112,211}; /// - std::array coord2 = {-42,23}; /// - Use your 'rotate_counter_clockwise' function to rotate both coordinate by 180 degrees /// - Print the resulting rotated coordinates to the console /// - Hint: the expected coordinates after rotating 180 degrees are /// - std::array coord1_rotated = {-112,-211}; /// - std::array coord2_rotated = {42,-23}; int main() { std::array coord1 = {112, 211}; std::cout << "Original coord1: " << coord1[0] << ", " << coord1[1] << std::endl; std::array coord1_rotated = task1::rotate_counter_clockwise(coord1, std::numbers::pi_v); std::cout << "Rotated coord1: " << coord1_rotated[0] << ", " << coord1_rotated[1] << std::endl; return 0; }