{
	"name": "sdarrow",
	"node_position": {
		"x": 0,
		"y": 0
	},
	"parameters": {
		"ax": -0.3,
		"ay": -0.3,
		"bx": 0.3,
		"by": 0.3,
		"k": 0.55,
		"wh": 0.3,
		"wt": 0.1
	},
	"seed_int": 0,
	"shader_model": {
		"code": "",
		"global": [
			"// The MIT License, Copyright © 2021 Inigo Quilez",
			"// https://www.shadertoy.com/view/slj3Dd",
			"",
			"float sdArrow( in vec2 p, vec2 a, vec2 b, float w1, float w2, float k)",
			"{",
			"\t// constant setup",
			"\tvec2  ba = b - a;",
			"\tfloat l2 = dot(ba,ba);",
			"\tfloat l = sqrt(l2);",
			"\t",
			"",
			"\t// pixel setup",
			"\tp = p-a;",
			"\tp = mat2(vec2(ba.x,-ba.y),vec2(ba.y,ba.x))*p/l;",
			"\tp.y = abs(p.y);",
			"\tvec2 pz = p-vec2(l-w2*k,w2);",
			"\t",
			"",
			"\t// === distance (four segments) === ",
			"",
			"\tvec2 q = p;",
			"\tq.x -= clamp( q.x, 0.0, l-w2*k );",
			"\tq.y -= w1;",
			"\tfloat di = dot(q,q);",
			"\t",
			"\t//----",
			"\tq = pz;",
			"\tq.y -= clamp( q.y, w1-w2, 0.0 );",
			"\tdi = min( di, dot(q,q) );",
			"\t//----",
			"\tif( p.x<w1 ) // conditional is optional",
			"\t{",
			"\tq = p;",
			"\tq.y -= clamp( q.y, 0.0, w1 );",
			"\tdi = min( di, dot(q,q) );",
			"\t}",
			"\t//----",
			"\tif( pz.x>0.0 ) // conditional is optional",
			"\t{",
			"\tq = pz;",
			"\tq -= vec2(k,-1.0)*clamp( (q.x*k-q.y)/(k*k+1.0), 0.0, w2 );",
			"\tdi = min( di, dot(q,q) );",
			"\t}",
			"\t",
			"\t// === sign === ",
			"\t",
			"\tfloat si = 1.0;",
			"\tfloat z = l - p.x;",
			"\tif( min(p.x,z)>0.0 ) //if( p.x>0.0 && z>0.0 )",
			"\t{",
			"\t  float h = (pz.x<0.0) ? w1 : z/k;",
			"\t  if( p.y<h ) si = -1.0;",
			"\t}",
			"\treturn si*sqrt(di);",
			"}"
		],
		"inputs": [

		],
		"instance": "",
		"longdesc": "An arrow described as a signed distance function",
		"name": "sdArrow",
		"outputs": [
			{
				"longdesc": "The shape as signed distance function",
				"sdf2d": "sdArrow($uv-0.5,vec2($ax,$ay),vec2($bx,$by),$wt,$wh,$k/$wh*distance(vec2($ax,$ay),vec2($bx,$by)))",
				"shortdesc": "Output",
				"type": "sdf2d"
			}
		],
		"parameters": [
			{
				"control": "P1.x",
				"default": -0.3,
				"label": "A X",
				"longdesc": "The position on the X axis of the first point of the arrow",
				"max": 1,
				"min": 0,
				"name": "ax",
				"shortdesc": "A.x",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "P1.y",
				"default": -0.3,
				"label": "A Y",
				"longdesc": "The position on the Y axis of the first point of the arrow",
				"max": 1,
				"min": 0,
				"name": "ay",
				"shortdesc": "A.y",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "P2.x",
				"default": 0.3,
				"label": "B X",
				"longdesc": "The position on the X axis of the second point of the arrow",
				"max": 1,
				"min": 0,
				"name": "bx",
				"shortdesc": "B.x",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "P2.y",
				"default": 0.3,
				"label": "B Y",
				"longdesc": "The position on the Y axis of the second point of the arrow",
				"max": 1,
				"min": 0,
				"name": "by",
				"shortdesc": "B.y",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "None",
				"default": 0.55,
				"label": "Ratio",
				"longdesc": "Ratio of the arrow head to tail",
				"max": 1,
				"min": 0,
				"name": "k",
				"shortdesc": "Ratio",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "None",
				"default": 0.4,
				"label": "Head",
				"longdesc": "Width of the arrow head",
				"max": 1,
				"min": 0,
				"name": "wh",
				"shortdesc": "Head width",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "None",
				"default": 0.1,
				"label": "Tail",
				"longdesc": "Width of the arrow tail",
				"max": 1,
				"min": 0,
				"name": "wt",
				"shortdesc": "Tail width",
				"step": 0.01,
				"type": "float"
			}
		],
		"shortdesc": "sdArrow"
	},
	"type": "shader"
}