![]() ![]() To perform the 90-degree counterclockwise rotation, imagine rotating the entire quadrant one-quarter turn in a counterclockwise direction. In this example, you have to rotate Point C positive 90 degrees, which is a one quarter turn counterclockwise. Solution: For rotation in the clockwise direction. Since 90 is positive, this will be a counterclockwise rotation. Solution: R 1 and R 2are rotation matricesĮxample2: Rotate a line CD whose endpoints are (3, 4) and (12, 15) about origin through a 45° anticlockwise direction.Įxample3: Rotate line AB whose endpoints are A (2, 5) and B (6, 12) about origin through a 30° clockwise direction. Step3: Translation of center of rotation back to its original positionĮxample1: Prove that 2D rotations about the origin are commutative i.e. Step2: Rotation of (x, y) about the origin ![]() Step1: Translate point (x c y c) to origin The (x c y c) is a point about which counterclockwise rotation is done We get rotation about an arbitrary point.Įxample: The point (x, y) is to be rotated Then rotate point or object about the origin, and at the end, we again translate it to the original place. Rotation about an arbitrary point: If we want to rotate an object or point about an arbitrary point, first of all, we translate the point about which we want to rotate to the origin. Matrix for homogeneous co-ordinate rotation (anticlockwise) Matrix for homogeneous co-ordinate rotation (clockwise) Matrix for rotation is an anticlockwise direction. Matrix for rotation is a clockwise direction. Polygon: Polygon is rotated by shifting every vertex using the same rotational angle.Ĭurved Lines: Curved Lines are rotated by repositioning of all points and drawing of the curve at new positions.Ĭircle: It can be obtained by center position by the specified angle.Įllipse: Its rotation can be obtained by rotating major and minor axis of an ellipse by the desired angle. Straight Line: Straight Line is rotated by the endpoints with the same angle and redrawing the line between new endpoints. When the object is rotated, then every point of the object is rotated by the same angle. The negative value of the pivot point (rotation angle) rotates an object in a clockwise direction. The positive value of the pivot point (rotation angle) rotates an object in a counter-clockwise (anti-clockwise) direction. It is print about which object is rotated. Rotation point is also called a pivot point. For rotation, we have to specify the angle of rotation and rotation point. Rotation can be clockwise or anticlockwise. Next for Q 1 1, print the element at row index 1 and column index 1 of A, which is 6.It is a process of changing the angle of the object. R 90 and R 90 => 90 + 90 => 180 degrees in clockwise direction).Īfter rotation the matrix will now become So the updated matrix will be,Īfter updating, we need to rotate the matrix by sum of all rotation angles applied till now(i.e. 1 will represent the end of input.Outputįor each Query operation print the element present at row index K and colum index L of the matrix in its current state.Explanationįor R 90, clockwise rotation by 90 degrees, the matrix will becomeįor Q 0 0, print the element at row index 0 and column index 0 of A, which is 3.įor Q 0 1, print the element at row index 0 and column index 1 of A, which is 1.Īgain for R 90, clockwise rotation by 90 degrees, the matrix will becomeįor Q 0 0, print the element at row index 0 and column index 0 of A, which is 4.įor U 0 0 6, update the value at row index 0 and column index 1 in the initial matrix to 6. Each operation on each line (Beginning either with R, U or Q). Next lines contain various operations on the array. Next N lines contain N space-separated integers Aij (i - index of the row, j - index of the column). The first line contains a single integer N. You need to print the value at row index K and column index L of the matrix A. In initial matrix A (as given in input), you need to update the element at row index X and column index Y with value Z.Īfter the update, all the previous rotation operations have to be applied to the updated initial matrix. The angle of rotation(S) will always be in multiples of 90 degrees. You need to rotate the matrix A by angle S in the clockwise direction. Rotation: It is represented as R S where S is an integer in which denotes the number of degrees to rotate. You need to apply the below given 3 operations on the matrix A. You are given a square matrix A of dimensions NxN.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |