MCPcopy Create free account
hub / github.com/nwutils/nw-sample-apps / initialNormal3

Function initialNormal3

webgl/js/three.min.js:31696–31725  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31694 }
31695
31696 function initialNormal3() {
31697 // select an initial normal vector perpenicular to the first tangent vector,
31698 // and in the direction of the smallest tangent xyz component
31699
31700 normals[ 0 ] = new THREE.Vector3();
31701 binormals[ 0 ] = new THREE.Vector3();
31702 smallest = Number.MAX_VALUE;
31703 tx = Math.abs( tangents[ 0 ].x );
31704 ty = Math.abs( tangents[ 0 ].y );
31705 tz = Math.abs( tangents[ 0 ].z );
31706
31707 if ( tx <= smallest ) {
31708 smallest = tx;
31709 normal.set( 1, 0, 0 );
31710 }
31711
31712 if ( ty <= smallest ) {
31713 smallest = ty;
31714 normal.set( 0, 1, 0 );
31715 }
31716
31717 if ( tz <= smallest ) {
31718 normal.set( 0, 0, 1 );
31719 }
31720
31721 vec.cross( tangents[ 0 ], normal ).normalize();
31722
31723 normals[ 0 ].cross( tangents[ 0 ], vec );
31724 binormals[ 0 ].cross( tangents[ 0 ], normals[ 0 ] );
31725 }
31726
31727
31728 // compute the slowly-varying normal and binormal vectors for each segment on the path

Callers 1

three.min.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected