function intersectTriangle(ray, triangle):
  edge1 = triangle.v2 - triangle.v1
  edge2 = triangle.v3 - triangle.v1
  h = cross(ray.direction, edge2)
  a = dot(edge1, h)
  if a > -EPSILON && a < EPSILON:
    return false  // ray is parallel to triangle
  f = 1.0 / a
  s = ray.origin - triangle.v1
  u = f * dot(s, h)
  if u < 0.0 || u > 1.0:
    return false  // intersection point is outside of triangle
  q = cross(s, edge1)
  v = f * dot(ray.direction, q)
  if v < 0.0 || u + v > 1.0:
    return false  // intersection point is outside of triangle
  t = f * dot(edge2, q)
  if t > EPSILON:
    return t  // ray intersects triangle
  else:
    return false  // ray misses triangle
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence