3 p = vec3(st - a, 0);
        float l = length(ab);
        float d = abs(cross(p, normalize(ab)).z);
        float proj = dot(p, ab) / l;
        if(proj >= 0.0 && proj <= l) return d;
        return min(distance(st, a), distance(st, b));
      }

      float triangle_distance(in vec2 st, in vec2 a, in vec2 b, in vec2 c) {
        float d1 = line_distance(st, a, b);
        float d2 = line_distance(st, b, c);
        float d3 = line_distance(st, c, a);

        if(d1 >= 0.0 && d2 >= 0.0 && d3 >= 0.0 || d1