The resulting two vectors have been rotated by an arbitrary angle on a particular 2D plane, but maintain orthogonality.Add the "remainder" set aside earlier back to the mapped ND vector. ![]() Transform the rotated 2D vectors back into ND vectors in the main coordinate system by multiplying the by the Nx2 matrix.Perform the rotation transformation on the 2D vectors. Construct the 2D rotation matrix corresponding to the desired rotation within the 2D plane identified in the first step.Keep in mind that the 2D vector is now in a modified coordinate space, not the original. Perform a change of basis on the projected N-D vectors so that they can be expressed as the product of a 2D vector and an Nx2 matrix, which has its columns set to each of the corresponding basis vectors calculated.Break up each of the two N-D orthogonal vectors you want to rotate into the sum of two vectors: 1) the vectors' projections onto the 2D plane you've constructed and 2) the "remainder" of the vector that doesn't fall on the 2D plane.Combined the N basis vectors should span the ND space. From these two points you can then find the slope of that line in 3D using the math found in the accepted answer to this post StackExchange:Mathematics and once you have the slope of that line and from basic mathematics any line that is orthogonal to another their products will -1. Find the remaining (N-2)D basis vectors that are linearly independent to these first 2 vectors.(the vectors you want to rotate, a and b, aren't necessarily on this plane) Find 2 linearly independent ND basis vectors of the 2D plane in which you want to rotate the two vectors.Here's a general outline of the steps I would take: Unless I've overlooked something, it'd be necessary to implement ND rotation from scratch. Preexisting implementations of 3D Rotation matrices include the Scipy function .from_rotvec and Python's quaternion module (see henneray's answer), but these are only for 3D vectors. #uncomment following to make basis orthonormalĪssert np.allclose(basis_vectors.dot(basis_vectors), 0)īecause you want to rotate both vectors in the same manner, there must be a way to preserve information on the way each rotation is carried out (e.g. Vector -= basis_vector.dot(vector) * vector We get matrix ( 1), as it should be.I have an answer to your first question and some thoughts on how to approach the second. ![]() Notice that if we put u x = cos θ and u y = sin θ in matrix ( 2), Taking this into account, we obtain the following matrix for a reflectionġ u x 2 + u y 2 . If u was not a unit vector to begin with, it of course suffices to divide by its magnitude before proceeding. Therefore the matrix of the transformation is Equivalently, the span of N is said to be the orthogonal complement of the span of U and V. The span of U and V is said to be the orthogonal complement of the span of N. To derive the matrix with respect to x, y coordinates, we resort to a trick: This is the plane that contains the origin and has unit-length normal N that is, any vector in hU Viis perpendicular to N. (In fact, this is the formula used in the to draw the diagram in this entry.) ![]() In the decomposition □ = a □ + b □,
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |