code: def get_line_seg_intersection(
      x1: jnp.float32,
      y1: jnp.float32,
      x2: jnp.float32,
      y2: jnp.float32,
      x3: jnp.float32,
      y3: jnp.float32,
      x4: jnp.float32,
      y4: jnp.float32,
  ) -> Tuple[bool, jnp.ndarray]:
      """Determine if line segment (x1, y1, x2, y2) intersects with line
      segment (x3, y3, x4, y4), and return the intersection coordinate.
      """
      denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1)
      ua = jnp.where(
          jnp.isclose(denominator, 0.0),
          0,
          ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator,
      )
      mask1 = jnp.bitwise_and(ua > 0.0, ua < 1.0)
      ub = jnp.where(
          jnp.isclose(denominator, 0.0),
          0,
          ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denominator,
      )
      mask2 = jnp.bitwise_and(ub > 0.0, ub < 1.0)
      intersected = jnp.bitwise_and(mask1, mask2)
      x_intersection = x1 + ua * (x2 - x1)
      y_intersection = y1 + ua * (y2 - y1)
      up = jnp.where(
          intersected,
          jnp.array([x_intersection, y_intersection]),
          jnp.array([SCREEN_W, SCREEN_W]),
      )
      return intersected, up
  
imports: from typing import Tuple
  from functools import partial
  from PIL import Image
  from PIL import ImageDraw
  import numpy
  import jax
  import jax.numpy
  from jax import random
  from jax import tree_util
  from flax.struct import dataclass
  from evojax.task.base import TaskState
  from evojax.task.base import VectorizedTask
label_desc: Use image node_id 5 for calling a global function with example usage: get_line_seg_intersection(x1, y1, x2, y2, x3, y3, x4, y4) and returns: intersected,  up