{
	"name": "sdellipse",
	"node_position": {
		"x": 0,
		"y": 0
	},
	"parameters": {
		"cx": 0,
		"cy": 0,
		"h": 0.3,
		"w": 0.4
	},
	"seed_int": 0,
	"shader_model": {
		"code": "",
		"global": [
			"// The MIT License, Copyright © 2015 Inigo Quilez",
			"float sd_ellipse( vec2 p, vec2 ab )",
			"{",
			"\t// symmetry",
			"\tp = abs( p );",
			"",
			"\t// find root with Newton solver",
			"\tvec2 q = ab*(p-ab);",
			"\tfloat w = (q.x<q.y)? 1.570796327 : 0.0;",
			"\tfor( int i=0; i<5; i++ )",
			"\t{",
			"\t\tvec2 cs = vec2(cos(w),sin(w));",
			"\t\tvec2 u = ab*vec2( cs.x,cs.y);",
			"\t\tvec2 v = ab*vec2(-cs.y,cs.x);",
			"\t\tw = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));",
			"\t}",
			"\t",
			"\t// compute final point and distance",
			"\tfloat d = length(p-ab*vec2(cos(w),sin(w)));",
			"\t",
			"\t// return signed distance",
			"\treturn (dot(p/ab,p/ab)>1.0) ? d : -d;",
			"}"

		],
		"inputs": [

		],
		"instance": "",
		"longdesc": "An ellipse described as a signed distance function",
		"name": "sdEllipse",
		"outputs": [
			{
				"longdesc": "The generated signed distance function",
				"sdf2d": "sd_ellipse($uv-vec2($cx+0.5, $cy+0.5), vec2($w, $h))",
				"shortdesc": "Output",
				"type": "sdf2d"
			}
		],
		"parameters": [
			{
				"control": "Rect1.x",
				"default": 0.5,
				"label": "Width",
				"longdesc": "The width of the ellipse",
				"max": 1,
				"min": 0,
				"name": "w",
				"shortdesc": "Width",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "Rect1.y",
				"default": 1,
				"label": "Height",
				"longdesc": "The height of the ellipse",
				"max": 1,
				"min": 0,
				"name": "h",
				"shortdesc": "Height",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "P1.x",
				"default": 0,
				"label": "Center X",
				"longdesc": "The position of the center of the ellipse on the X axis",
				"max": 1,
				"min": -1,
				"name": "cx",
				"shortdesc": "Center.x",
				"step": 0.01,
				"type": "float"
			},
			{
				"control": "P1.y",
				"default": 0,
				"label": "Center Y",
				"longdesc": "The position of the center of the ellipse on the Y axis",
				"max": 1,
				"min": -1,
				"name": "cy",
				"shortdesc": "Center.y",
				"step": 0.01,
				"type": "float"
			}
		],
		"shortdesc": "sdEllipse"
	},
	"type": "shader"
}