setRay method Null safety

void setRay(
  1. Ray ray,
  2. double limitMin,
  3. double limitMax
)

Set the AABB to enclose a limited ray (or line segment) that is limited by limitMin and limitMax.

Implementation

void setRay(Ray ray, double limitMin, double limitMax) {
  ray
    ..copyAt(_min, limitMin)
    ..copyAt(_max, limitMax);

  if (_max.x < _min.x) {
    final temp = _max.x;
    _max.x = _min.x;
    _min.x = temp;
  }

  if (_max.y < _min.y) {
    final temp = _max.y;
    _max.y = _min.y;
    _min.y = temp;
  }

  if (_max.z < _min.z) {
    final temp = _max.z;
    _max.z = _min.z;
    _min.z = temp;
  }
}