{
	"name": "sdtrapezoid",
	"node_position": {
		"x": 0,
		"y": 0
	},
	"parameters": {
		"cx": 0,
		"cy": 0,
		"height": 0.433489,
		"r1": 0.152504,
		"r2": 0.39
	},
	"seed": 0,
	"seed_locked": false,
	"shader_model": {
		"code": "",
		"global": "float sdTrapezoid( in vec2 p, in float r1, float r2, float he )\n{\n    vec2 k1 = vec2(r2,he);\n    vec2 k2 = vec2(r2-r1,2.0*he);\n    p.x = abs(p.x);\n    vec2 ca = vec2(p.x-min(p.x,(p.y<0.0)?r1:r2), abs(p.y)-he);\n    vec2 cb = p - k1 + k2*clamp( dot(k1-p,k2)/dot2(k2), 0.0, 1.0 );\n    float s = (cb.x<0.0 && ca.y<0.0) ? -1.0 : 1.0;\n    return s*sqrt( min(dot2(ca),dot2(cb)) );\n}",
		"inputs": [

		],
		"instance": "",
		"longdesc": "A trapezoid described as a signed distance function",
		"name": "sdTrapezoid",
		"outputs": [
			{
				"longdesc": "The trapezoid as a signed distance function",
				"sdf2d": "sdTrapezoid($uv - 0.5 - vec2($cx, $cy), $r1, $r2, $height)",
				"shortdesc": "Output",
				"type": "sdf2d"
			}
		],
		"parameters": [
			{
				"control": "Radius1.r",
				"default": 0.5,
				"label": "Top Width",
				"longdesc": "Top width of the trapezoid",
				"max": 1,
				"min": 0,
				"name": "r1",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "Rect1.x",
				"default": 0.3,
				"label": "Bottom Width",
				"longdesc": "Bottom width of the trapezoid",
				"max": 1,
				"min": 0,
				"name": "r2",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "Rect1.y",
				"default": 0.5,
				"label": "Height",
				"longdesc": "Height of the trapezoid",
				"max": 1,
				"min": 0,
				"name": "height",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "P1.x",
				"default": 0,
				"label": "Center X",
				"longdesc": "The position of the center on the X axis",
				"max": 0.5,
				"min": -0.5,
				"name": "cx",
				"shortdesc": "Center.x",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "P1.y",
				"default": 0,
				"label": "Center Y",
				"longdesc": "The position of the center on the Y axis",
				"max": 0.5,
				"min": -0.5,
				"name": "cy",
				"shortdesc": "Center.y",
				"step": 0.01,
				"type": "float"
			}
		],
		"shortdesc": "sdTrapezoid"
	},
	"type": "shader"
}