Compute a right-handed orthonormal basis for the orthogonal complement of the input vectors. The function returns the smallest length of the unnormalized vectors computed during the process. If this value is nearly zero, it is possible that the inputs are linearly dependent (within numerical round-off errors).
| 66 | // nearly zero, it is possible that the inputs are linearly dependent |
| 67 | // (within numerical round-off errors). |
| 68 | Basis3D compute_orthogonal_basis( const geode::Vector3D& axis ) |
| 69 | { |
| 70 | Basis3D basis; |
| 71 | basis[0] = axis; |
| 72 | if( std::fabs( axis.value( 0 ) ) > std::fabs( axis.value( 1 ) ) ) |
| 73 | { |
| 74 | basis[1] = |
| 75 | geode::Vector3D{ { -axis.value( 2 ), 0, axis.value( 0 ) } }; |
| 76 | } |
| 77 | else |
| 78 | { |
| 79 | basis[1] = |
| 80 | geode::Vector3D{ { 0, axis.value( 2 ), -axis.value( 1 ) } }; |
| 81 | } |
| 82 | basis[2] = basis[0].cross( basis[1] ); |
| 83 | orthonormalize( basis ); |
| 84 | return basis; |
| 85 | } |
| 86 | |
| 87 | struct CylinderLineResult |
| 88 | { |
no test coverage detected