{
	"name": "sdcirclerepeat",
	"node_position": {
		"x": 0,
		"y": 0
	},
	"parameters": {
		"c": 6,
		"variations": false
	},
	"seed_int": 0,
	"shader_model": {
		"code": [
			"float $(name_uv)_ids = $variations ? rand(vec2((floor(fract((0.15915494309*atan($uv.x - 0.5, $uv.y - 0.5) - 0.5 / $c)) * $c) / $c))) + $seed : 0.0;",
			"float $(name_uv)_in = $in.variation(circle_repeat_transform_2d($uv-vec2(0.5), $c)+vec2(0.5), $(name_uv)_ids);"
		],
		"global": [
			"vec2 circle_repeat_transform_2d(vec2 p, float count) {",
			"\tfloat r = 6.28318530718/count;",
			"\tfloat pa = atan(p.x, p.y);",
			"\tfloat a = mod(pa+0.5*r, r)-0.5*r;",
			"\tvec2 rv;",
			"\tfloat c = cos(a-pa);",
			"\tfloat s = sin(a-pa);",
			"\trv.x = p.x*c+p.y*s;",
			"\trv.y = -p.x*s+p.y*c;",
			"\treturn rv;",
			"}",
			""
		],
		"inputs": [
			{
				"default": "0.0",
				"function": true,
				"label": "",
				"longdesc": "The input shape, defined as a signed distance function",
				"name": "in",
				"shortdesc": "Input",
				"type": "sdf2d"
			}
		],
		"instance": "",
		"longdesc": "Repeats its input shape around a circle",
		"name": "Circle Repeat",
		"outputs": [
			{
				"longdesc": "The shape generated by the repeat operation",
				"sdf2d": "$(name_uv)_in",
				"shortdesc": "Output",
				"type": "sdf2d"
			}
		],
		"parameters": [
			{
				"control": "None",
				"default": 4,
				"label": "",
				"longdesc": "The number of repetitions of the input shape around the circle",
				"max": 32,
				"min": 1,
				"name": "c",
				"shortdesc": "Count",
				"step": 1,
				"type": "float"
			},
			{
				"default": false,
				"label": "Variations",
				"longdesc": "Check to repeat variations of the input",
				"name": "variations",
				"shortdesc": "Variations",
				"type": "boolean"
			}
		],
		"shortdesc": "Circle Repeat"
	},
	"type": "shader"
}