Decompose rotations of a vector

  • Context: Undergrad 
  • Thread starter Thread starter TheDestroyer
  • Start date Start date
  • Tags Tags
    Rotations Vector
Click For Summary
SUMMARY

This discussion focuses on generating two perpendicular vectors from a given normal vector in C++ for creating a circular signal using sine and cosine functions. The method involves defining a plane with the normal vector and solving for an orthonormal basis. The process includes selecting arbitrary components for one vector, calculating the cross product to find the other two perpendicular vectors, and normalizing them to unit vectors. This approach effectively decomposes the rotation of the input vector to achieve the desired orthogonal vectors.

PREREQUISITES
  • C++ programming proficiency
  • Understanding of vector mathematics
  • Knowledge of cross product and normalization techniques
  • Familiarity with Euler angles and their application in 3D transformations
NEXT STEPS
  • Study vector normalization techniques in C++
  • Learn about cross product calculations and their geometric interpretations
  • Explore the application of Euler angles in 3D graphics
  • Investigate the implementation of orthonormal bases in computational geometry
USEFUL FOR

Software developers, particularly those working in graphics programming, game development, or simulations that require vector manipulation and signal generation.

TheDestroyer
Messages
401
Reaction score
1
Hello guys,

I'm programming a class in C++ that generates a circular signal. The signal consists of a sin and cos in perpendicular directions.

The user has to input the norm to the surface, and the program generates the sine and cosine in 2 perpendicular directions to that norm to generate the circular signal.

The question is the following. If the user provided this vector, how can I find those 2 perpendicular vectors?

I think this problem can be reduced to finding the Euler angles that rotated this vector from being parallel to the z plane. So that the cosine remains on the x-axis, and the sine on the y-axis. Is it possible to decompose it that way?
 
Last edited:
Physics news on Phys.org
TheDestroyer said:
Hello guys,

I'm programming a class in C++ that generates a circular signal. The signal consists of a sin and cos in perpendicular directions.

The user has to input the norm to the surface, and the program generates the sine and cosine in 2 perpendicular directions to that norm to generate the circular signal.

The question is the following. If the user provided this vector, how can I find those 2 perpendicular vectors?

I think this problem can be reduced to finding the Euler angles that rotated this vector from being parallel to the z plane. So that the cosine remains on the x-axis, and the sine on the yyaxis. Is it possible to decompose it that way?

Hey TheDestroyer.

If you have the vector that is normal to the surface, then you can define the plane using n . (r - r0) = 0 where n is the normal and r0 is a point on the plane. Now to get the orthornomal basis (the two perpendicular vectors with respect to the supplied one) you have to solve the equation n . a = 0 for some a. Just choose the x and y components of a randomly and then solve for the z component of a. Normalize a to a unit vector.

After this you take the cross product of n and a to get a vector b and then take the cross product of n and b to get c. Normalize c and b and your perpendicular orthogonal unit vectors to n are the normalized c and b vectors and that completes your orthonormalization.
 
Thanks a lot, man :-)
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
67
Views
4K
Replies
21
Views
4K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K