MCPcopy Create free account
hub / github.com/divan/gotrace / initialNormal3

Function initialNormal3

page/js/three.js:39557–39594  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39555 */
39556
39557 function initialNormal3() {
39558
39559 // select an initial normal vector perpendicular to the first tangent vector,
39560 // and in the direction of the smallest tangent xyz component
39561
39562 normals[ 0 ] = new THREE.Vector3();
39563 binormals[ 0 ] = new THREE.Vector3();
39564 smallest = Number.MAX_VALUE;
39565 tx = Math.abs( tangents[ 0 ].x );
39566 ty = Math.abs( tangents[ 0 ].y );
39567 tz = Math.abs( tangents[ 0 ].z );
39568
39569 if ( tx <= smallest ) {
39570
39571 smallest = tx;
39572 normal.set( 1, 0, 0 );
39573
39574 }
39575
39576 if ( ty <= smallest ) {
39577
39578 smallest = ty;
39579 normal.set( 0, 1, 0 );
39580
39581 }
39582
39583 if ( tz <= smallest ) {
39584
39585 normal.set( 0, 0, 1 );
39586
39587 }
39588
39589 vec.crossVectors( tangents[ 0 ], normal ).normalize();
39590
39591 normals[ 0 ].crossVectors( tangents[ 0 ], vec );
39592 binormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] );
39593
39594 }
39595
39596
39597 // compute the slowly-varying normal and binormal vectors for each segment on the path

Callers 1

three.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected