tangents method
Compute two artificial tangents to the vector @param t1 Vector object to save the first tangent in @param t2 Vector object to save the second tangent in
Implementation
void tangents(Vec3 t1, Vec3 t2){
final norm = length();
if (norm > 0.0) {
final n = vec3TangentsN;
final inorm = 1 / norm;
n.set(x * inorm, y * inorm, z * inorm);
final randVec = vec3TangentsRandVec;
if (n.x.abs() < 0.9) {
randVec.set(1, 0, 0);
n.cross(randVec, t1);
} else {
randVec.set(0, 1, 0);
n.cross(randVec, t1);
}
n.cross(t1, t2);
} else {
// The normal length is zero, make something up
t1.set(1, 0, 0);
t2.set(0, 1, 0);
}
}