{
	"name": "sdtriangle",
	"node_position": {
		"x": 0,
		"y": 0
	},
	"parameters": {
		"p1x": 0.18415,
		"p1y": -0.245523,
		"p2x": 0.287197,
		"p2y": 0.316552,
		"p3x": -0.387293,
		"p3y": 0.218189
	},
	"seed": 0,
	"seed_locked": false,
	"shader_model": {
		"code": "",
		"global": "float sdTriangle( in vec2 p, in vec2 p0, in vec2 p1, in vec2 p2 )\n{\n    vec2 e0 = p1-p0, e1 = p2-p1, e2 = p0-p2;\n    vec2 v0 = p -p0, v1 = p -p1, v2 = p -p2;\n    vec2 pq0 = v0 - e0*clamp( dot(v0,e0)/dot(e0,e0), 0.0, 1.0 );\n    vec2 pq1 = v1 - e1*clamp( dot(v1,e1)/dot(e1,e1), 0.0, 1.0 );\n    vec2 pq2 = v2 - e2*clamp( dot(v2,e2)/dot(e2,e2), 0.0, 1.0 );\n    float s = sign( e0.x*e2.y - e0.y*e2.x );\n    vec2 d = min(min(vec2(dot(pq0,pq0), s*(v0.x*e0.y-v0.y*e0.x)),\n                     vec2(dot(pq1,pq1), s*(v1.x*e1.y-v1.y*e1.x))),\n                     vec2(dot(pq2,pq2), s*(v2.x*e2.y-v2.y*e2.x)));\n    return -sqrt(d.x)*sign(d.y);\n}",
		"inputs": [

		],
		"instance": "",
		"longdesc": "A triangle described as a signed distance function",
		"name": "sdTriangle",
		"outputs": [
			{
				"longdesc": "The triangle as a signed distance function",
				"sdf2d": "sdTriangle($uv - 0.5, vec2($p1x, $p1y), vec2($p2x, $p2y), vec2($p3x, $p3y))",
				"shortdesc": "Output",
				"type": "sdf2d"
			}
		],
		"parameters": [
			{
				"control": "P1.x",
				"default": 0.2,
				"label": "Point 1 X",
				"longdesc": "The position on the X axis of the first point of the triangle",
				"max": 0.5,
				"min": -0.5,
				"name": "p1x",
				"shortdesc": "Center.x",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "P1.y",
				"default": -0.25,
				"label": "Point 1 Y",
				"longdesc": "The position on the Y axis of the first point of the triangle",
				"max": 0.5,
				"min": -0.5,
				"name": "p1y",
				"shortdesc": "Center.y",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "P2.x",
				"default": 0.3,
				"label": "Point 2 X",
				"longdesc": "The position on the X axis of the second point of the triangle",
				"max": 0.5,
				"min": -0.5,
				"name": "p2x",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "P2.y",
				"default": 0.3,
				"label": "Point 2 Y",
				"longdesc": "The position on the Y axis of the second point of the triangle",
				"max": 0.5,
				"min": -0.5,
				"name": "p2y",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "P3.x",
				"default": -0.4,
				"label": "Point 3 X",
				"longdesc": "The position on the X axis of the third point of the triangle",
				"max": 0.5,
				"min": -0.5,
				"name": "p3x",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "P3.y",
				"default": 0.2,
				"label": "Point 3 Y",
				"longdesc": "The position on the Y axis of the third point of the triangle",
				"max": 0.5,
				"min": -0.5,
				"name": "p3y",
				"step": 0.01,
				"type": "float"
			}
		],
		"shortdesc": "sdTriangle"
	},
	"type": "shader"
}