@@ -203,12 +203,10 @@ class Aabb3 {
203
203
_max.setFrom (other._max);
204
204
}
205
205
206
- static Vector3 _center;
207
- static Vector3 _halfExtents;
208
- void _updateCenterAndHalfExtents () => copyCenterAndHalfExtents (
209
- _center ?? = Vector3 .zero (),
210
- _halfExtents ?? = Vector3 .zero (),
211
- );
206
+ static late final _center = Vector3 .zero ();
207
+ static late final _halfExtents = Vector3 .zero ();
208
+ void _updateCenterAndHalfExtents () =>
209
+ copyCenterAndHalfExtents (_center, _halfExtents);
212
210
213
211
/// Transform this by the transform [t] .
214
212
void transform (Matrix4 t) {
@@ -394,7 +392,7 @@ class Aabb3 {
394
392
/// found, result is modified to contain more details about the type of
395
393
/// intersection.
396
394
bool intersectsWithTriangle (Triangle other,
397
- {double epsilon = 1e-3 , IntersectionResult result}) {
395
+ {double epsilon = 1e-3 , IntersectionResult ? result}) {
398
396
double p0, p1, p2, r, len;
399
397
double a;
400
398
@@ -437,7 +435,7 @@ class Aabb3 {
437
435
}
438
436
439
437
a = math.min (p0, p2) - r;
440
- if (result != null && (result._depth == null || result._depth < a)) {
438
+ if (result != null && (result._depth == null || ( result._depth! ) < a)) {
441
439
result._depth = a;
442
440
_u0.crossInto (_f0, result.axis);
443
441
}
@@ -455,7 +453,7 @@ class Aabb3 {
455
453
}
456
454
457
455
a = math.min (p0, p1) - r;
458
- if (result != null && (result._depth == null || result._depth < a)) {
456
+ if (result != null && (result._depth == null || ( result._depth! ) < a)) {
459
457
result._depth = a;
460
458
_u0.crossInto (_f1, result.axis);
461
459
}
@@ -473,7 +471,7 @@ class Aabb3 {
473
471
}
474
472
475
473
a = math.min (p0, p1) - r;
476
- if (result != null && (result._depth == null || result._depth < a)) {
474
+ if (result != null && (result._depth == null || ( result._depth! ) < a)) {
477
475
result._depth = a;
478
476
_u0.crossInto (_f2, result.axis);
479
477
}
@@ -491,7 +489,7 @@ class Aabb3 {
491
489
}
492
490
493
491
a = math.min (p0, p2) - r;
494
- if (result != null && (result._depth == null || result._depth < a)) {
492
+ if (result != null && (result._depth == null || ( result._depth! ) < a)) {
495
493
result._depth = a;
496
494
_u1.crossInto (_f0, result.axis);
497
495
}
@@ -509,7 +507,7 @@ class Aabb3 {
509
507
}
510
508
511
509
a = math.min (p0, p1) - r;
512
- if (result != null && (result._depth == null || result._depth < a)) {
510
+ if (result != null && (result._depth == null || ( result._depth! ) < a)) {
513
511
result._depth = a;
514
512
_u1.crossInto (_f1, result.axis);
515
513
}
@@ -527,7 +525,7 @@ class Aabb3 {
527
525
}
528
526
529
527
a = math.min (p0, p1) - r;
530
- if (result != null && (result._depth == null || result._depth < a)) {
528
+ if (result != null && (result._depth == null || ( result._depth! ) < a)) {
531
529
result._depth = a;
532
530
_u1.crossInto (_f2, result.axis);
533
531
}
@@ -545,7 +543,7 @@ class Aabb3 {
545
543
}
546
544
547
545
a = math.min (p0, p2) - r;
548
- if (result != null && (result._depth == null || result._depth < a)) {
546
+ if (result != null && (result._depth == null || ( result._depth! ) < a)) {
549
547
result._depth = a;
550
548
_u2.crossInto (_f0, result.axis);
551
549
}
@@ -563,7 +561,7 @@ class Aabb3 {
563
561
}
564
562
565
563
a = math.min (p0, p1) - r;
566
- if (result != null && (result._depth == null || result._depth < a)) {
564
+ if (result != null && (result._depth == null || ( result._depth! ) < a)) {
567
565
result._depth = a;
568
566
_u2.crossInto (_f1, result.axis);
569
567
}
@@ -581,7 +579,7 @@ class Aabb3 {
581
579
}
582
580
583
581
a = math.min (p0, p1) - r;
584
- if (result != null && (result._depth == null || result._depth < a)) {
582
+ if (result != null && (result._depth == null || ( result._depth! ) < a)) {
585
583
result._depth = a;
586
584
_u2.crossInto (_f2, result.axis);
587
585
}
@@ -594,7 +592,7 @@ class Aabb3 {
594
592
return false ;
595
593
}
596
594
a = math.min (_v0.x, math.min (_v1.x, _v2.x)) - _aabbHalfExtents[0 ];
597
- if (result != null && (result._depth == null || result._depth < a)) {
595
+ if (result != null && (result._depth == null || ( result._depth! ) < a)) {
598
596
result._depth = a;
599
597
result.axis.setFrom (_u0);
600
598
}
@@ -604,7 +602,7 @@ class Aabb3 {
604
602
return false ;
605
603
}
606
604
a = math.min (_v0.y, math.min (_v1.y, _v2.y)) - _aabbHalfExtents[1 ];
607
- if (result != null && (result._depth == null || result._depth < a)) {
605
+ if (result != null && (result._depth == null || ( result._depth! ) < a)) {
608
606
result._depth = a;
609
607
result.axis.setFrom (_u1);
610
608
}
@@ -614,7 +612,7 @@ class Aabb3 {
614
612
return false ;
615
613
}
616
614
a = math.min (_v0.z, math.min (_v1.z, _v2.z)) - _aabbHalfExtents[2 ];
617
- if (result != null && (result._depth == null || result._depth < a)) {
615
+ if (result != null && (result._depth == null || ( result._depth! ) < a)) {
618
616
result._depth = a;
619
617
result.axis.setFrom (_u2);
620
618
}
@@ -630,7 +628,7 @@ class Aabb3 {
630
628
}
631
629
632
630
/// Return if this intersects with [other]
633
- bool intersectsWithPlane (Plane other, {IntersectionResult result}) {
631
+ bool intersectsWithPlane (Plane other, {IntersectionResult ? result}) {
634
632
// This line is not necessary with a (center, extents) AABB representation
635
633
copyCenterAndHalfExtents (_aabbCenter, _aabbHalfExtents);
636
634
@@ -643,7 +641,7 @@ class Aabb3 {
643
641
// Intersection occurs when distance s falls within [-r,+r] interval
644
642
if (s.abs () <= r) {
645
643
final a = s - r;
646
- if (result != null && (result._depth == null || result._depth < a)) {
644
+ if (result != null && (result._depth == null || ( result._depth! ) < a)) {
647
645
result._depth = a;
648
646
result.axis.setFrom (other.normal);
649
647
}
@@ -662,7 +660,7 @@ class Aabb3 {
662
660
/// If [result] is specified and an intersection is
663
661
/// found, result is modified to contain more details about the type of
664
662
/// intersection.
665
- bool intersectsWithQuad (Quad other, {IntersectionResult result}) {
663
+ bool intersectsWithQuad (Quad other, {IntersectionResult ? result}) {
666
664
other.copyTriangles (_quadTriangle0, _quadTriangle1);
667
665
668
666
return intersectsWithTriangle (_quadTriangle0, result: result) ||
0 commit comments