@@ -73,7 +73,7 @@ class Vertex {
7373
7474
7575 normalize ( ) {
76- const length = Math . sqrt ( this . x ** 2 + this . y ** 2 + this . z ** 2 ) ;
76+ const length = Math . sqrt ( this . x ** 2 + this . y ** 2 + this . z ** 2 ) ;
7777
7878 this . x /= length ;
7979 this . y /= length ;
@@ -83,16 +83,16 @@ class Vertex {
8383 }
8484
8585 dot ( vertex ) {
86- return this . x * vertex . x + this . y * vertex . y + this . z * vertex . z ;
86+ return this . x * vertex . x + this . y * vertex . y + this . z * vertex . z ;
8787 }
8888
8989 diff ( vertex ) {
9090 const dx = ( this . x - vertex . x ) ,
9191 dy = ( this . y - vertex . y ) ,
9292 dz = ( this . z - vertex . z ) ,
93- len2 = this . x ** 2 + this . y ** 2 + this . z ** 2 ;
93+ len2 = this . x ** 2 + this . y ** 2 + this . z ** 2 ;
9494
95- return ( dx ** 2 + dy ** 2 + dz ** 2 ) / ( len2 > 0 ? len2 : 1e-10 ) ;
95+ return ( dx ** 2 + dy ** 2 + dz ** 2 ) / ( len2 > 0 ? len2 : 1e-10 ) ;
9696 }
9797
9898 /*
@@ -119,8 +119,8 @@ class Vertex {
119119
120120 interpolate ( a , t ) {
121121 const t1 = 1 - t ;
122- return new Vertex ( this . x * t1 + a . x * t , this . y * t1 + a . y * t , this . z * t1 + a . z * t ,
123- this . nx * t1 + a . nx * t , this . ny * t1 + a . ny * t , this . nz * t1 + a . nz * t ) ;
122+ return new Vertex ( this . x * t1 + a . x * t , this . y * t1 + a . y * t , this . z * t1 + a . z * t ,
123+ this . nx * t1 + a . nx * t , this . ny * t1 + a . ny * t , this . nz * t1 + a . nz * t ) ;
124124 }
125125
126126 applyMatrix4 ( m ) {
@@ -277,7 +277,7 @@ class Polygon {
277277 // t = (this.w - this.normal.dot(vi))/this.normal.dot(vj.clone().subtract(vi));
278278 // v = vi.clone().lerp( vj, t );
279279
280- t = ( this . w - ( nnx * vi . x + nny * vi . y + nnz * vi . z ) ) / ( nnx * ( vj . x - vi . x ) + nny * ( vj . y - vi . y ) + nnz * ( vj . z - vi . z ) ) ;
280+ t = ( this . w - ( nnx * vi . x + nny * vi . y + nnz * vi . z ) ) / ( nnx * ( vj . x - vi . x ) + nny * ( vj . y - vi . y ) + nnz * ( vj . z - vi . z ) ) ;
281281
282282 v = vi . interpolate ( vj , t ) ;
283283 f . push ( v ) ;
@@ -457,20 +457,20 @@ function createBufferGeometry(polygons) {
457457
458458 function CopyVertex ( vertex ) {
459459 positions_buf [ iii ] = vertex . x ;
460- positions_buf [ iii + 1 ] = vertex . y ;
461- positions_buf [ iii + 2 ] = vertex . z ;
460+ positions_buf [ iii + 1 ] = vertex . y ;
461+ positions_buf [ iii + 2 ] = vertex . z ;
462462
463463 normals_buf [ iii ] = polygon . nsign * vertex . nx ;
464- normals_buf [ iii + 1 ] = polygon . nsign * vertex . ny ;
465- normals_buf [ iii + 2 ] = polygon . nsign * vertex . nz ;
466- iii += 3 ;
464+ normals_buf [ iii + 1 ] = polygon . nsign * vertex . ny ;
465+ normals_buf [ iii + 2 ] = polygon . nsign * vertex . nz ;
466+ iii += 3 ;
467467 }
468468
469469 for ( i = 0 ; i < polygon_count ; ++ i ) {
470470 polygon = polygons [ i ] ;
471471 for ( j = 2 ; j < polygon . vertices . length ; ++ j ) {
472472 CopyVertex ( polygon . vertices [ 0 ] ) ;
473- CopyVertex ( polygon . vertices [ j - 1 ] ) ;
473+ CopyVertex ( polygon . vertices [ j - 1 ] ) ;
474474 CopyVertex ( polygon . vertices [ j ] ) ;
475475 }
476476 }
@@ -504,18 +504,18 @@ class Geometry {
504504 polygons = [ ] ;
505505 let polygon , vert1 , vert2 , vert3 ;
506506
507- for ( let i = 0 ; i < pos_buf . length ; i += 9 ) {
507+ for ( let i = 0 ; i < pos_buf . length ; i += 9 ) {
508508 polygon = new Polygon ( ) ;
509509
510- vert1 = new Vertex ( pos_buf [ i ] , pos_buf [ i + 1 ] , pos_buf [ i + 2 ] , norm_buf [ i ] , norm_buf [ i + 1 ] , norm_buf [ i + 2 ] ) ;
510+ vert1 = new Vertex ( pos_buf [ i ] , pos_buf [ i + 1 ] , pos_buf [ i + 2 ] , norm_buf [ i ] , norm_buf [ i + 1 ] , norm_buf [ i + 2 ] ) ;
511511 if ( transfer_matrix )
512512 vert1 . applyMatrix4 ( transfer_matrix ) ;
513513
514- vert2 = new Vertex ( pos_buf [ i + 3 ] , pos_buf [ i + 4 ] , pos_buf [ i + 5 ] , norm_buf [ i + 3 ] , norm_buf [ i + 4 ] , norm_buf [ i + 5 ] ) ;
514+ vert2 = new Vertex ( pos_buf [ i + 3 ] , pos_buf [ i + 4 ] , pos_buf [ i + 5 ] , norm_buf [ i + 3 ] , norm_buf [ i + 4 ] , norm_buf [ i + 5 ] ) ;
515515 if ( transfer_matrix )
516516 vert2 . applyMatrix4 ( transfer_matrix ) ;
517517
518- vert3 = new Vertex ( pos_buf [ i + 6 ] , pos_buf [ i + 7 ] , pos_buf [ i + 8 ] , norm_buf [ i + 6 ] , norm_buf [ i + 7 ] , norm_buf [ i + 8 ] ) ;
518+ vert3 = new Vertex ( pos_buf [ i + 6 ] , pos_buf [ i + 7 ] , pos_buf [ i + 8 ] , norm_buf [ i + 6 ] , norm_buf [ i + 7 ] , norm_buf [ i + 8 ] ) ;
519519 if ( transfer_matrix )
520520 vert3 . applyMatrix4 ( transfer_matrix ) ;
521521
@@ -683,11 +683,11 @@ class Geometry {
683683 while ( foundpair ) {
684684 foundpair = false ;
685685
686- for ( i1 = 0 ; i1 < len - 1 ; ++ i1 ) {
686+ for ( i1 = 0 ; i1 < len - 1 ; ++ i1 ) {
687687 p1 = parts [ i1 ] ;
688688 if ( ! p1 ?. parent )
689689 continue ;
690- for ( i2 = i1 + 1 ; i2 < len ; ++ i2 ) {
690+ for ( i2 = i1 + 1 ; i2 < len ; ++ i2 ) {
691691 p2 = parts [ i2 ] ;
692692 if ( p2 && ( p1 . parent === p2 . parent ) && ( p1 . nsign === p2 . nsign ) ) {
693693 if ( p1 . nsign !== p1 . parent . nsign )
@@ -830,19 +830,19 @@ function createNormal(axis_name, pos, size) {
830830
831831 switch ( axis_name ) {
832832 case 'x' :
833- vertices = [ new Vertex ( pos , - 3 * size , size , 1 , 0 , 0 ) ,
834- new Vertex ( pos , size , - 3 * size , 1 , 0 , 0 ) ,
833+ vertices = [ new Vertex ( pos , - 3 * size , size , 1 , 0 , 0 ) ,
834+ new Vertex ( pos , size , - 3 * size , 1 , 0 , 0 ) ,
835835 new Vertex ( pos , size , size , 1 , 0 , 0 ) ] ;
836836 break ;
837837 case 'y' :
838- vertices = [ new Vertex ( - 3 * size , pos , size , 0 , 1 , 0 ) ,
838+ vertices = [ new Vertex ( - 3 * size , pos , size , 0 , 1 , 0 ) ,
839839 new Vertex ( size , pos , size , 0 , 1 , 0 ) ,
840- new Vertex ( size , pos , - 3 * size , 0 , 1 , 0 ) ] ;
840+ new Vertex ( size , pos , - 3 * size , 0 , 1 , 0 ) ] ;
841841 break ;
842842 // case 'z':
843843 default :
844- vertices = [ new Vertex ( - 3 * size , size , pos , 0 , 0 , 1 ) ,
845- new Vertex ( size , - 3 * size , pos , 0 , 0 , 1 ) ,
844+ vertices = [ new Vertex ( - 3 * size , size , pos , 0 , 0 , 1 ) ,
845+ new Vertex ( size , - 3 * size , pos , 0 , 0 , 1 ) ,
846846 new Vertex ( size , size , pos , 0 , 0 , 1 ) ] ;
847847 }
848848
0 commit comments