| 32409 | */ |
| 32410 | |
| 32411 | function initialNormal3() { |
| 32412 | // select an initial normal vector perpenicular to the first tangent vector, |
| 32413 | // and in the direction of the smallest tangent xyz component |
| 32414 | |
| 32415 | normals[ 0 ] = new THREE.Vector3(); |
| 32416 | binormals[ 0 ] = new THREE.Vector3(); |
| 32417 | smallest = Number.MAX_VALUE; |
| 32418 | tx = Math.abs( tangents[ 0 ].x ); |
| 32419 | ty = Math.abs( tangents[ 0 ].y ); |
| 32420 | tz = Math.abs( tangents[ 0 ].z ); |
| 32421 | |
| 32422 | if ( tx <= smallest ) { |
| 32423 | smallest = tx; |
| 32424 | normal.set( 1, 0, 0 ); |
| 32425 | } |
| 32426 | |
| 32427 | if ( ty <= smallest ) { |
| 32428 | smallest = ty; |
| 32429 | normal.set( 0, 1, 0 ); |
| 32430 | } |
| 32431 | |
| 32432 | if ( tz <= smallest ) { |
| 32433 | normal.set( 0, 0, 1 ); |
| 32434 | } |
| 32435 | |
| 32436 | vec.crossVectors( tangents[ 0 ], normal ).normalize(); |
| 32437 | |
| 32438 | normals[ 0 ].crossVectors( tangents[ 0 ], vec ); |
| 32439 | binormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ); |
| 32440 | } |
| 32441 | |
| 32442 | |
| 32443 | // compute the slowly-varying normal and binormal vectors for each segment on the path |