Line between points

Lines

float line(vec2 p1, vec2 p2, float width, vec2 uv)
{
	vec2 segment = p2 - p1;
	float length_squared = dot(segment, segment);
	float t = length_squared > 0.0 ? clamp(dot(uv - p1, segment) / length_squared, 0.0, 1.0) : 0.0;
	// Width is measured in thousandths of UV space, not pixels.
	return 1.0 - step(0.001 * width, distance(p1 + t * segment, uv));
}

void fragment()
{
	vec2 point1 = vec2(0.45, 0.2);
	vec2 point2 = vec2(0.55, 0.5);
	vec2 point3 = vec2(0.45, 0.8);
	
	vec3 color  = vec3(line(point1, point2, 2.0, UV));
		 color += vec3(line(point2, point3, 2.0, UV));
	
	COLOR = vec4(color, 1.0);
}

This snippet is converted from this Shadertoy shader.