intersectsWithTriangle method

bool intersectsWithTriangle (Triangle other, { IntersectionResult result })

Return if this intersects with other

Implementation

bool intersectsWithTriangle(Triangle other, {IntersectionResult result}) {
  _triangle.copyFrom(other);

  _triangle.point0
    ..sub(_center)
    ..setValues(_triangle.point0.dot(axis0), _triangle.point0.dot(axis1),
        _triangle.point0.dot(axis2));
  _triangle.point1
    ..sub(_center)
    ..setValues(_triangle.point1.dot(axis0), _triangle.point1.dot(axis1),
        _triangle.point1.dot(axis2));
  _triangle.point2
    ..sub(_center)
    ..setValues(_triangle.point2.dot(axis0), _triangle.point2.dot(axis1),
        _triangle.point2.dot(axis2));

  _aabb3.setCenterAndHalfExtents(_zeroVector, _halfExtents);

  return _aabb3.intersectsWithTriangle(_triangle, result: result);
}