File tree Expand file tree Collapse file tree 3 files changed +9
-87
lines changed Expand file tree Collapse file tree 3 files changed +9
-87
lines changed Original file line number Diff line number Diff line change @@ -252,25 +252,8 @@ THREE.Vector2.prototype = {
252
252
253
253
// This function assumes min < max, if this assumption isn't true it will not operate correctly
254
254
255
- if ( this . x < min . x ) {
256
-
257
- this . x = min . x ;
258
-
259
- } else if ( this . x > max . x ) {
260
-
261
- this . x = max . x ;
262
-
263
- }
264
-
265
- if ( this . y < min . y ) {
266
-
267
- this . y = min . y ;
268
-
269
- } else if ( this . y > max . y ) {
270
-
271
- this . y = max . y ;
272
-
273
- }
255
+ this . x = Math . max ( min . x , Math . min ( max . x , this . x ) ) ;
256
+ this . y = Math . max ( min . y , Math . min ( max . y , this . y ) ) ;
274
257
275
258
return this ;
276
259
Original file line number Diff line number Diff line change @@ -464,35 +464,9 @@ THREE.Vector3.prototype = {
464
464
465
465
// This function assumes min < max, if this assumption isn't true it will not operate correctly
466
466
467
- if ( this . x < min . x ) {
468
-
469
- this . x = min . x ;
470
-
471
- } else if ( this . x > max . x ) {
472
-
473
- this . x = max . x ;
474
-
475
- }
476
-
477
- if ( this . y < min . y ) {
478
-
479
- this . y = min . y ;
480
-
481
- } else if ( this . y > max . y ) {
482
-
483
- this . y = max . y ;
484
-
485
- }
486
-
487
- if ( this . z < min . z ) {
488
-
489
- this . z = min . z ;
490
-
491
- } else if ( this . z > max . z ) {
492
-
493
- this . z = max . z ;
494
-
495
- }
467
+ this . x = Math . max ( min . x , Math . min ( max . x , this . x ) ) ;
468
+ this . y = Math . max ( min . y , Math . min ( max . y , this . y ) ) ;
469
+ this . z = Math . max ( min . z , Math . min ( max . z , this . z ) ) ;
496
470
497
471
return this ;
498
472
Original file line number Diff line number Diff line change @@ -473,45 +473,10 @@ THREE.Vector4.prototype = {
473
473
474
474
// This function assumes min < max, if this assumption isn't true it will not operate correctly
475
475
476
- if ( this . x < min . x ) {
477
-
478
- this . x = min . x ;
479
-
480
- } else if ( this . x > max . x ) {
481
-
482
- this . x = max . x ;
483
-
484
- }
485
-
486
- if ( this . y < min . y ) {
487
-
488
- this . y = min . y ;
489
-
490
- } else if ( this . y > max . y ) {
491
-
492
- this . y = max . y ;
493
-
494
- }
495
-
496
- if ( this . z < min . z ) {
497
-
498
- this . z = min . z ;
499
-
500
- } else if ( this . z > max . z ) {
501
-
502
- this . z = max . z ;
503
-
504
- }
505
-
506
- if ( this . w < min . w ) {
507
-
508
- this . w = min . w ;
509
-
510
- } else if ( this . w > max . w ) {
511
-
512
- this . w = max . w ;
513
-
514
- }
476
+ this . x = Math . max ( min . x , Math . min ( max . x , this . x ) ) ;
477
+ this . y = Math . max ( min . y , Math . min ( max . y , this . y ) ) ;
478
+ this . z = Math . max ( min . z , Math . min ( max . z , this . z ) ) ;
479
+ this . w = Math . max ( min . w , Math . min ( max . w , this . w ) ) ;
515
480
516
481
return this ;
517
482
You can’t perform that action at this time.
0 commit comments