{
    "nodes": [
        {
            "datums": [
                {
                    "expr": "0",
                    "name": "x0",
                    "type": "float",
                    "uid": 0
                },
                {
                    "expr": "0",
                    "name": "y0",
                    "type": "float",
                    "uid": 1
                },
                {
                    "expr": "20",
                    "name": "r",
                    "type": "float",
                    "uid": 2
                },
                {
                    "expr": "0",
                    "name": "_a",
                    "type": "float",
                    "uid": 3
                },
                {
                    "expr": "\u0012fab.types.Shape('-r+qXqYf20',float('-20.000000'),float('-20.000000'),float('-inf'),float('20.000000'),float('20.000000'),float('inf'))",
                    "name": "shape",
                    "type": "_fabtypes.Shape",
                    "uid": 4
                }
            ],
            "inspector": [
                -362.0280426782489,
                -352.98917469647137
            ],
            "name": "c0",
            "script": [
                "# Neil Gershenfeld 1/24/15",
                "# Matt Keeter 6/11/18",
                "",
                "import fab",
                "import math",
                "",
                "title('Circle (center)')",
                "",
                "input('x0',float)",
                "input('y0',float)",
                "input('r',float)",
                "input('_a',float)",
                "",
                "output('shape', fab.shapes.circle(x0, y0, r))",
                "",
                "def drag_r(this,x,y,z):",
                "    dx = x - this.x0",
                "    dy = y - this.y0",
                "    this.r = math.sqrt(dx**2 + dy**2)",
                "    this._a = math.atan2(dy, dx)",
                "",
                "# UI",
                "sb.ui.wireframe([",
                "    (math.cos(i/36. * 2*math.pi) * r + x0,",
                "     math.sin(i/36. * 2*math.pi) * r + y0, 0)",
                "    for i in range(36)], close=True)",
                "sb.ui.point(x0,y0)",
                "sb.ui.point(x0 + r*math.cos(_a),",
                "             y0 + r*math.sin(_a),",
                "             drag=drag_r, relative=False)",
                "",
                ""
            ],
            "uid": 0
        },
        {
            "datums": [
                {
                    "expr": "\u0011[__0.__0]",
                    "name": "x0",
                    "type": "float",
                    "uid": 0
                },
                {
                    "expr": "c0.y0+c0.r",
                    "name": "y0",
                    "type": "float",
                    "uid": 1
                },
                {
                    "expr": "6.4",
                    "name": "width",
                    "type": "float",
                    "uid": 2
                },
                {
                    "expr": "12",
                    "name": "height",
                    "type": "float",
                    "uid": 3
                },
                {
                    "expr": "\u0012fab.types.Shape('aa-f-3.2X-Xf3.2a-f14Y-Yf26',float('-3.200000'),float('14.000000'),float('-inf'),float('3.200000'),float('26.000000'),float('inf'))",
                    "name": "shape",
                    "type": "_fabtypes.Shape",
                    "uid": 4
                }
            ],
            "inspector": [
                -54.812052162304184,
                -292.1166039453324
            ],
            "name": "r0",
            "script": [
                "# Neil Gershenfeld 1/24/15",
                "# Matt Keeter 6/11/15",
                "",
                "import fab",
                "",
                "title('Rectangle (center)')",
                "",
                "input('x0', float)",
                "input('y0', float)",
                "input('width', float)",
                "input('height', float)",
                "",
                "xmin, xmax = x0 - width/2, x0 + width/2",
                "ymin, ymax = y0 - height/2, y0 + height/2",
                "",
                "output('shape', fab.shapes.rectangle(xmin, xmax, ymin, ymax))",
                "",
                "def drag_hw(this, x, y, z):",
                "   this.width = abs(2 * (x - this.x0))",
                "   this.height = abs(2 * (y - this.y0))",
                "",
                "# UI",
                "sb.ui.wireframe(",
                "        [(xmin, ymin, 0), (xmax, ymin, 0), (xmax, ymax, 0), (xmin, ymax, 0)],",
                "        close=True)",
                "sb.ui.point(x0, y0)",
                "sb.ui.point(xmax, ymax, drag=drag_hw, relative=False)",
                ""
            ],
            "uid": 1
        },
        {
            "datums": [
                {
                    "expr": "\u0011[__1.__4]",
                    "name": "shape",
                    "type": "_fabtypes.Shape",
                    "uid": 0
                },
                {
                    "expr": "0.0",
                    "name": "x",
                    "type": "float",
                    "uid": 1
                },
                {
                    "expr": "0.0",
                    "name": "y",
                    "type": "float",
                    "uid": 2
                },
                {
                    "expr": "6",
                    "name": "n",
                    "type": "int",
                    "uid": 3
                },
                {
                    "expr": "\u0012fab.types.Shape('iiiiim-Xf0-Yf0-Zf0m+*f1X*f0Y+*f-0X*f1Y_m-Xf-0-Yf-0-Zf0aa-f-3.2X-Xf3.2a-f14Y-Yf26m-Xf0-Yf0-Zf0m+*f0.5X*f0.866025Y+*f-0.866025X*f0.5Y_m-Xf-0-Yf-0-Zf0aa-f-3.2X-Xf3.2a-f14Y-Yf26m-Xf0-Yf0-Zf0m+*f-0.5X*f0.866025Y+*f-0.866025X*f-0.5Y_m-Xf-0-Yf-0-Zf0aa-f-3.2X-Xf3.2a-f14Y-Yf26m-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16Y+*f-1.22465e-16X*f-1Y_m-Xf-0-Yf-0-Zf0aa-f-3.2X-Xf3.2a-f14Y-Yf26m-Xf0-Yf0-Zf0m+*f-0.5X*f-0.866025Y+*f0.866025X*f-0.5Y_m-Xf-0-Yf-0-Zf0aa-f-3.2X-Xf3.2a-f14Y-Yf26m-Xf0-Yf0-Zf0m+*f0.5X*f-0.866025Y+*f0.866025X*f0.5Y_m-Xf-0-Yf-0-Zf0aa-f-3.2X-Xf3.2a-f14Y-Yf26',float('-24.116650'),float('-26.000000'),float('-inf'),float('24.116650'),float('26.000000'),float('inf'))",
                    "name": "array",
                    "type": "_fabtypes.Shape",
                    "uid": 4
                }
            ],
            "inspector": [
                -13.0971699544437,
                -88.71488220786044
            ],
            "name": "a0",
            "script": [
                "import fab",
                "import math",
                "",
                "title('Array (polar)')",
                "",
                "input('shape', fab.types.Shape)",
                "input('x', float)",
                "input('y', float)",
                "input('n', int)",
                "",
                "output('array', fab.shapes.iterate_polar(shape, x, y, n))",
                "",
                "# UI",
                "sb.ui.wireframe([",
                "    (math.cos(i/36. * 2*math.pi) * 0.3 + x,",
                "     math.sin(i/36. * 2*math.pi) * 0.3 + y, 0)",
                "    for i in range(36)], close=True, color=sb.color.teal)",
                "",
                "sb.ui.point(x, y, 0, color=sb.color.teal)",
                ""
            ],
            "uid": 2
        },
        {
            "datums": [
                {
                    "expr": "\u0011[__0.__4]",
                    "name": "a",
                    "type": "_fabtypes.Shape",
                    "uid": 0
                },
                {
                    "expr": "\u0011[__2.__4]",
                    "name": "b",
                    "type": "_fabtypes.Shape",
                    "uid": 1
                },
                {
                    "expr": "\u0012fab.types.Shape('a-r+qXqYf20niiiiim-Xf0-Yf0-Zf0m+*f1X*f0Y+*f-0X*f1Y_m-Xf-0-Yf-0-Zf0aa-f-3.2X-Xf3.2a-f14Y-Yf26m-Xf0-Yf0-Zf0m+*f0.5X*f0.866025Y+*f-0.866025X*f0.5Y_m-Xf-0-Yf-0-Zf0aa-f-3.2X-Xf3.2a-f14Y-Yf26m-Xf0-Yf0-Zf0m+*f-0.5X*f0.866025Y+*f-0.866025X*f-0.5Y_m-Xf-0-Yf-0-Zf0aa-f-3.2X-Xf3.2a-f14Y-Yf26m-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16Y+*f-1.22465e-16X*f-1Y_m-Xf-0-Yf-0-Zf0aa-f-3.2X-Xf3.2a-f14Y-Yf26m-Xf0-Yf0-Zf0m+*f-0.5X*f-0.866025Y+*f0.866025X*f-0.5Y_m-Xf-0-Yf-0-Zf0aa-f-3.2X-Xf3.2a-f14Y-Yf26m-Xf0-Yf0-Zf0m+*f0.5X*f-0.866025Y+*f0.866025X*f0.5Y_m-Xf-0-Yf-0-Zf0aa-f-3.2X-Xf3.2a-f14Y-Yf26',float('-20.000000'),float('-20.000000'),float('-inf'),float('20.000000'),float('20.000000'),float('inf'))",
                    "name": "shape",
                    "type": "_fabtypes.Shape",
                    "uid": 2
                }
            ],
            "inspector": [
                -57.49889169191579,
                146.56580235194212
            ],
            "name": "d0",
            "script": [
                "import fab.types",
                "",
                "title('Difference')",
                "input('a', fab.types.Shape)",
                "input('b', fab.types.Shape)",
                "",
                "output('shape', a & ~b)",
                ""
            ],
            "uid": 3
        }
    ],
    "protocol": 6,
    "type": "sb"
}
