Computing a Basis

Given a normalized 3D vector, here’s an efficient method for computing a full basis. The computed basis is axis aligned if the input vector is axis aligned.

In SSE land you can eliminate the branch using a select operation.

2 thoughts on “Computing a Basis

  1. Forgive me if I’m misunderstanding, but shouldn’t line 6 have an Abs call wrapped around the a.x value? If you pass in the vector { 0, 0, -1 } don’t you get a zero for b (without the abs)?

Comments are closed.