Search code examples
mathvectormath

Solve for a vector given one component and direction expressed as a unit vector


Say that I have the y-component of a 3D vector and I have a unit vector expressing the direction of the final desired vector. How would I go about solving for the X and Z components? Thanks!


Solution

  • Simple ratio, where u* are unit vector components

     dx = ux * dy / uy
     dz = uz * dy / uy
    

    (because unit vector components are defined as ux = dx / Len with common Len, and dy/uy is really vector length)