如何在不旋轉矩陣的情況下旋轉總矩陣之後在給定矩陣中找到索引x,y處的元素。在C/C++中旋轉後,在給定矩陣的x,y處查找元素?
這意味着我只是對該座標感興趣,並不希望對總矩陣執行全部操作,而只是簡單地獲取任何索引處的元素。
Example: suppose a matrix is given 1 2 3 4 5 6 7 8 9 and i want to find the element at 1,1 after rotating the matrix by 90 degree. answer should be "7". **NOTE**: Without performing the rotation on total matrix. and if i want the element at 1,2 than the answer should be "4". I hope I clearly communicated the question please help if you know the solution or algorithm for this question. Thank you.
所以你想找到元素執行旋轉的功能?或者只是一個計算一個元素將要去哪裏的函數? 無論哪種方式你需要計算旋轉 – Mixone
也元素1,1將5,元素0,0將7,索引開始於0而不是1 – Mixone
旋轉座標在相反的方向矩陣將旋轉。 –