Skip to content

Instantly share code, notes, and snippets.

@saljam
Created February 15, 2017 23:02
Show Gist options
  • Save saljam/1e8d4860c3a212db0fc1813685d3d9a6 to your computer and use it in GitHub Desktop.
Save saljam/1e8d4860c3a212db0fc1813685d3d9a6 to your computer and use it in GitHub Desktop.
{
"nodes": [
{
"datums": [
{
"expr": "\u0011[__3.__5]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 0
},
{
"expr": "3.55",
"name": "radius",
"type": "float",
"uid": 1
},
{
"expr": "\u0012fab.types.Shape('m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-4.050000'),float('-31.201508'),float('-4.050000'),float('4.050000'),float('33.236824'),float('4.050000'))",
"name": "wrapped",
"type": "_fabtypes.Shape",
"uid": 2
}
],
"inspector": [
-101.70471662523107,
291.02376659465301
],
"name": "c1",
"script": [
"import fab",
"",
"title('Cylinder Wrap (Y-axis)')",
"input('shape', fab.types.Shape)",
"input('radius', float)",
"",
"output(\"wrapped\", fab.shapes.cylinder_y_wrap(shape, radius))",
""
],
"uid": 1
},
{
"datums": [
{
"expr": "-60",
"name": "xmin",
"type": "float",
"uid": 0
},
{
"expr": "60",
"name": "xmax",
"type": "float",
"uid": 1
},
{
"expr": "1.2",
"name": "y",
"type": "float",
"uid": 2
},
{
"expr": "0",
"name": "z",
"type": "float",
"uid": 3
},
{
"expr": "0.5",
"name": "r",
"type": "float",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-60.000000'),float('0.700000'),float('-0.500000'),float('60.000000'),float('1.700000'),float('0.500000'))",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
-161.92321494284789,
-91.109566416752898
],
"name": "c0",
"script": [
"import fab",
"import math",
"",
"title('Cylinder (X)')",
"",
"input('xmin', float)",
"input('xmax', float)",
"input('y', float)",
"input('z', float)",
"input('r', float)",
"",
"output('shape', fab.shapes.cylinder_x(xmin, xmax, y, z, r))",
"",
"# UI",
"sb.ui.wireframe([(xmin, y, z), (xmax, y, z)])",
"sb.ui.wireframe([(xmin, y, z), (xmin, y, z + r)])",
"",
"sb.ui.wireframe([",
" (xmin, math.cos(i/36. * 2*math.pi) * r + y,",
" math.sin(i/36. * 2*math.pi) * r + z)",
" for i in range(36)], close=True)",
"",
"sb.ui.wireframe([",
" (xmax, math.cos(i/36. * 2*math.pi) * r + y,",
" math.sin(i/36. * 2*math.pi) * r + z)",
" for i in range(36)], close=True)",
"",
"sb.ui.point(xmin, y, z)",
"sb.ui.point(xmax, y, z)",
"sb.ui.point(xmin, y, z + r, drag=(None, None, r))",
""
],
"uid": 0
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0",
"name": "y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "_z",
"type": "float",
"uid": 2
},
{
"expr": "32",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__0.__5]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-51.783741'),float('-31.201508'),float('-0.500000'),float('50.511932'),float('33.236824'),float('0.500000'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
169.62319458104534,
-54.020713735914057
],
"name": "r1",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Z)')",
"",
"input('x', float)",
"input('y', float)",
"input('_z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_z(shape, a, x, y))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), y + math.sin(rad), _z),",
" (x, y, _z),",
" (x + 1, y, _z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3,",
" y + math.sin(math.radians(a_)) * 0.3, _z)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, y, _z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(y - this.y, x - this.x))",
"sb.ui.point(x + math.cos(rad), y + math.sin(rad), _z,",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 3
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "90",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__1.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f6.12323e-17X*f1ZY+*f-1X*f6.12323e-17Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-4.050000'),float('-31.201508'),float('-4.050000'),float('4.050000'),float('33.236824'),float('4.050000'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
314.97591637196433,
506.33057668497872
],
"name": "r0",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 2
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "0",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__1.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f1X*f0ZY+*f-0X*f1Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-4.050000'),float('-31.201508'),float('-4.050000'),float('4.050000'),float('33.236824'),float('4.050000'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
298.34249343367634,
407.80731395029449
],
"name": "r2",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 4
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "180",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__1.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16ZY+*f-1.22465e-16X*f-1Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-4.050000'),float('-31.201508'),float('-4.050000'),float('4.050000'),float('33.236824'),float('4.050000'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
338.07707345320841,
559.7916219196062
],
"name": "r3",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 5
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "-90",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__1.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f6.12323e-17X*f-1ZY+*f1X*f6.12323e-17Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-4.050000'),float('-31.201508'),float('-4.050000'),float('4.050000'),float('33.236824'),float('4.050000'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
353.86145696265976,
673.20241912589722
],
"name": "r4",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 6
},
{
"datums": [
{
"expr": "\u0011[__3.__5]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 0
},
{
"expr": "-3.55",
"name": "radius",
"type": "float",
"uid": 1
},
{
"expr": "\u0012fab.types.Shape('m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-4.050000'),float('-31.201508'),float('-4.050000'),float('4.050000'),float('33.236824'),float('4.050000'))",
"name": "wrapped",
"type": "_fabtypes.Shape",
"uid": 2
}
],
"inspector": [
-134.3345265460033,
469.19454566897912
],
"name": "c2",
"script": [
"import fab",
"",
"title('Cylinder Wrap (Y-axis)')",
"input('shape', fab.types.Shape)",
"input('radius', float)",
"",
"output(\"wrapped\", fab.shapes.cylinder_y_wrap(shape, radius))",
""
],
"uid": 7
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "0",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__7.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f1X*f0ZY+*f-0X*f1Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-4.050000'),float('-31.201508'),float('-4.050000'),float('4.050000'),float('33.236824'),float('4.050000'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
257.25879443523576,
1258.02273280589
],
"name": "r5",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 8
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "45",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__7.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107ZY+*f-0.707107X*f0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-5.727567'),float('-31.201508'),float('-5.727567'),float('5.727567'),float('33.236824'),float('5.727567'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
268.8514057009956,
1452.1721174769752
],
"name": "r6",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 9
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "45*2",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__7.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f6.12323e-17X*f1ZY+*f-1X*f6.12323e-17Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-4.050000'),float('-31.201508'),float('-4.050000'),float('4.050000'),float('33.236824'),float('4.050000'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
265.76984134741218,
1646.3106717527221
],
"name": "r7",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 10
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "45*3",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__7.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f-0.707107X*f0.707107ZY+*f-0.707107X*f-0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-5.727567'),float('-31.201508'),float('-5.727567'),float('5.727567'),float('33.236824'),float('5.727567'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
247.22470820020169,
1836.6453276698733
],
"name": "r8",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 11
},
{
"datums": [
{
"expr": "0",
"name": "x0",
"type": "float",
"uid": 0
},
{
"expr": "0",
"name": "y0",
"type": "float",
"uid": 1
},
{
"expr": "5.758196",
"name": "width",
"type": "float",
"uid": 2
},
{
"expr": "0.4",
"name": "height",
"type": "float",
"uid": 3
},
{
"expr": "\u0012fab.types.Shape('aa-f-2.8791X-Xf2.8791a-f-0.2Y-Yf0.2',float('-2.879098'),float('-0.200000'),float('-inf'),float('2.879098'),float('0.200000'),float('inf'))",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
}
],
"inspector": [
804.51085194612165,
143.34920634676348
],
"name": "r9",
"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": 12
},
{
"datums": [
{
"expr": "3",
"name": "x0",
"type": "float",
"uid": 0
},
{
"expr": "3.5",
"name": "y0",
"type": "float",
"uid": 1
},
{
"expr": "0.5",
"name": "width",
"type": "float",
"uid": 2
},
{
"expr": "8",
"name": "height",
"type": "float",
"uid": 3
},
{
"expr": "\u0012fab.types.Shape('aa-f2.75X-Xf3.25a-f-0.5Y-Yf7.5',float('2.750000'),float('-0.500000'),float('-inf'),float('3.250000'),float('7.500000'),float('inf'))",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
}
],
"inspector": [
749.54413244842635,
352.95362504834941
],
"name": "r10",
"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": 13
},
{
"datums": [
{
"expr": "\u0011[__12.__4,__25.__2]",
"name": "a",
"type": "_fabtypes.Shape",
"uid": 0
},
{
"expr": "0",
"name": "x",
"type": "float",
"uid": 1
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0imr+qXqZ__m-Xf-0-Yf0-Zf0iaa-f-2.8791X-Xf2.8791a-f-0.2Y-Yf0.2aaa-f2.75X-Xf3.25a-f-0.5Y-Yf7.5nini-*f-3.02015-Xf4.18355*f-0.891279-Yf6.51344i-*f6.21824-Xf3.29227*f-0.378029-Yf3.4933-*f-3.19809-Xf2.91424*f1.26931-Yf9.71154ni-*f-5.58839-Xf3.43948*f0.16482-Yf5.04931i-*f-0.526394-Xf3.6043*f-0.546044-Yf-0.539081-*f6.11478-Xf3.05825*f0.381224-Yf-1.06547mnr+qXqZ__m-Xf-0-Yf0-Zf0iaa-f-2.8791X-Xf2.8791a-f-0.2Y-Yf0.2aaa-f2.75X-Xf3.25a-f-0.5Y-Yf7.5nini-*f-3.02015-Xf4.18355*f-0.891279-Yf6.51344i-*f6.21824-Xf3.29227*f-0.378029-Yf3.4933-*f-3.19809-Xf2.91424*f1.26931-Yf9.71154ni-*f-5.58839-Xf3.43948*f0.16482-Yf5.04931i-*f-0.526394-Xf3.6043*f-0.546044-Yf-0.539081-*f6.11478-Xf3.05825*f0.381224-Yf-1.06547',float('-3.250000'),float('-0.500000'),float('-3.250000'),float('3.250000'),float('7.500000'),float('3.250000'))",
"name": "out",
"type": "_fabtypes.Shape",
"uid": 2
}
],
"inspector": [
1187.7505668731831,
321.80434077844865
],
"name": "r11",
"script": [
"# Neil Gershenfeld 2/1/15",
"# Matt Keeter 6/13/15",
"",
"import fab",
"",
"title('Revolve (Y)')",
"",
"input('a', fab.types.Shape)",
"input('x', float)",
"",
"output('out', fab.shapes.revolve_xy_y(a, x))",
"",
""
],
"uid": 14
},
{
"datums": [
{
"expr": "\u0011[__14.__2]",
"name": "a",
"type": "_fabtypes.Shape",
"uid": 0
},
{
"expr": "\u0011[__4.__5,__2.__5,__5.__5,__6.__5,__8.__5,__9.__5,__10.__5,__11.__5,__17.__5,__18.__5,__19.__5,__20.__5,__21.__5,__22.__5,__23.__5,__24.__5]",
"name": "b",
"type": "_fabtypes.Shape",
"uid": 1
},
{
"expr": "\u0012fab.types.Shape('am-Xf0-Yf0-Zf0imr+qXqZ__m-Xf-0-Yf0-Zf0iaa-f-2.8791X-Xf2.8791a-f-0.2Y-Yf0.2aaa-f2.75X-Xf3.25a-f-0.5Y-Yf7.5nini-*f-3.02015-Xf4.18355*f-0.891279-Yf6.51344i-*f6.21824-Xf3.29227*f-0.378029-Yf3.4933-*f-3.19809-Xf2.91424*f1.26931-Yf9.71154ni-*f-5.58839-Xf3.43948*f0.16482-Yf5.04931i-*f-0.526394-Xf3.6043*f-0.546044-Yf-0.539081-*f6.11478-Xf3.05825*f0.381224-Yf-1.06547mnr+qXqZ__m-Xf-0-Yf0-Zf0iaa-f-2.8791X-Xf2.8791a-f-0.2Y-Yf0.2aaa-f2.75X-Xf3.25a-f-0.5Y-Yf7.5nini-*f-3.02015-Xf4.18355*f-0.891279-Yf6.51344i-*f6.21824-Xf3.29227*f-0.378029-Yf3.4933-*f-3.19809-Xf2.91424*f1.26931-Yf9.71154ni-*f-5.58839-Xf3.43948*f0.16482-Yf5.04931i-*f-0.526394-Xf3.6043*f-0.546044-Yf-0.539081-*f6.11478-Xf3.05825*f0.381224-Yf-1.06547niiiiiiiiiiiiiiim-Xf0-Yf0-Zf0m+*f1X*f0ZY+*f-0X*f1Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f6.12323e-17X*f1ZY+*f-1X*f6.12323e-17Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16ZY+*f-1.22465e-16X*f-1Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f6.12323e-17X*f-1ZY+*f1X*f6.12323e-17Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f1X*f0ZY+*f-0X*f1Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107ZY+*f-0.707107X*f0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f6.12323e-17X*f1ZY+*f-1X*f6.12323e-17Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f-0.707107X*f0.707107ZY+*f-0.707107X*f-0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f0.707107X*f-0.707107ZY+*f0.707107X*f0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f-0.707107X*f-0.707107ZY+*f0.707107X*f-0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f-0.707107X*f0.707107ZY+*f-0.707107X*f-0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107ZY+*f-0.707107X*f0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16ZY+*f-1.22465e-16X*f-1Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f-0.707107X*f-0.707107ZY+*f0.707107X*f-0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f-1.83697e-16X*f-1ZY+*f1X*f-1.83697e-16Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f0.707107X*f-0.707107ZY+*f0.707107X*f0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-3.250000'),float('-0.500000'),float('-3.250000'),float('3.250000'),float('7.500000'),float('3.250000'))",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 2
}
],
"inspector": [
838.57230061291511,
2091.419650478771
],
"name": "d0",
"script": [
"import fab.types",
"",
"title('Difference')",
"input('a', fab.types.Shape)",
"input('b', fab.types.Shape)",
"",
"output('shape', a & ~b)",
""
],
"uid": 15
},
{
"datums": [
{
"expr": "\u0011[__15.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 0
},
{
"expr": "\u0012fab.types.Shape('am-Xf0-Yf0-Zf0imr+qXqZ__m-Xf-0-Yf0-Zf0iaa-f-2.8791X-Xf2.8791a-f-0.2Y-Yf0.2aaa-f2.75X-Xf3.25a-f-0.5Y-Yf7.5nini-*f-3.02015-Xf4.18355*f-0.891279-Yf6.51344i-*f6.21824-Xf3.29227*f-0.378029-Yf3.4933-*f-3.19809-Xf2.91424*f1.26931-Yf9.71154ni-*f-5.58839-Xf3.43948*f0.16482-Yf5.04931i-*f-0.526394-Xf3.6043*f-0.546044-Yf-0.539081-*f6.11478-Xf3.05825*f0.381224-Yf-1.06547mnr+qXqZ__m-Xf-0-Yf0-Zf0iaa-f-2.8791X-Xf2.8791a-f-0.2Y-Yf0.2aaa-f2.75X-Xf3.25a-f-0.5Y-Yf7.5nini-*f-3.02015-Xf4.18355*f-0.891279-Yf6.51344i-*f6.21824-Xf3.29227*f-0.378029-Yf3.4933-*f-3.19809-Xf2.91424*f1.26931-Yf9.71154ni-*f-5.58839-Xf3.43948*f0.16482-Yf5.04931i-*f-0.526394-Xf3.6043*f-0.546044-Yf-0.539081-*f6.11478-Xf3.05825*f0.381224-Yf-1.06547niiiiiiiiiiiiiiim-Xf0-Yf0-Zf0m+*f1X*f0ZY+*f-0X*f1Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f6.12323e-17X*f1ZY+*f-1X*f6.12323e-17Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16ZY+*f-1.22465e-16X*f-1Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f6.12323e-17X*f-1ZY+*f1X*f6.12323e-17Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f1X*f0ZY+*f-0X*f1Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107ZY+*f-0.707107X*f0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f6.12323e-17X*f1ZY+*f-1X*f6.12323e-17Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f-0.707107X*f0.707107ZY+*f-0.707107X*f-0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f0.707107X*f-0.707107ZY+*f0.707107X*f0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f-0.707107X*f-0.707107ZY+*f0.707107X*f-0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f-0.707107X*f0.707107ZY+*f-0.707107X*f-0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107ZY+*f-0.707107X*f0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16ZY+*f-1.22465e-16X*f-1Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f-0.707107X*f-0.707107ZY+*f0.707107X*f-0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f-1.83697e-16X*f-1ZY+*f1X*f-1.83697e-16Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60m-Xf0-Yf0-Zf0m+*f0.707107X*f-0.707107ZY+*f0.707107X*f0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-3.250000'),float('-0.500000'),float('-3.250000'),float('3.250000'),float('7.500000'),float('3.250000'))",
"name": "out",
"type": "_fabtypes.Shape",
"uid": 1
}
],
"inspector": [
1229.2487702847425,
2270.5147753131241
],
"name": "m0",
"script": [
"import fab",
"",
"title('Mesh (.stl)')",
"",
"input('shape', fab.types.Shape)",
"output('out', shape)",
"",
"sb.export.stl(shape)",
""
],
"uid": 16
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "-45",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__1.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f0.707107X*f-0.707107ZY+*f0.707107X*f0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-5.727567'),float('-31.201508'),float('-5.727567'),float('5.727567'),float('33.236824'),float('5.727567'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
344.58578402796513,
931.64442583973903
],
"name": "r12",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 17
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "-45*3",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__1.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f-0.707107X*f-0.707107ZY+*f0.707107X*f-0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-5.727567'),float('-31.201508'),float('-5.727567'),float('5.727567'),float('33.236824'),float('5.727567'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
354.58578402796519,
986.6209960206927
],
"name": "r13",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 18
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "-45*5",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__1.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f-0.707107X*f0.707107ZY+*f-0.707107X*f-0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-5.727567'),float('-31.201508'),float('-5.727567'),float('5.727567'),float('33.236824'),float('5.727567'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
341.73533540483538,
1029.4558247644588
],
"name": "r14",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 19
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "-45*7",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__1.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f0.707107X*f0.707107ZY+*f-0.707107X*f0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / 3.550000), (Z / 3.550000) )) * 3.550000;_=((sqrt( ((X / 3.550000))**2 + ((Z / 3.550000))**2 )) - 1) * 3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-5.727567'),float('-31.201508'),float('-5.727567'),float('5.727567'),float('33.236824'),float('5.727567'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
373.8614569626597,
855.97476835220721
],
"name": "r15",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 20
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "45*4",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__7.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f-1X*f1.22465e-16ZY+*f-1.22465e-16X*f-1Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-4.050000'),float('-31.201508'),float('-4.050000'),float('4.050000'),float('33.236824'),float('4.050000'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
227.24032807956559,
2043.6855398911964
],
"name": "r16",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 21
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "45*5",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__7.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f-0.707107X*f-0.707107ZY+*f0.707107X*f-0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-5.727567'),float('-31.201508'),float('-5.727567'),float('5.727567'),float('33.236824'),float('5.727567'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
201.67722522067129,
2171.4405245465005
],
"name": "r17",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 22
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "45*6",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__7.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f-1.83697e-16X*f-1ZY+*f1X*f-1.83697e-16Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-4.050000'),float('-31.201508'),float('-4.050000'),float('4.050000'),float('33.236824'),float('4.050000'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
232.7855234568184,
2280.5512871545834
],
"name": "r18",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 23
},
{
"datums": [
{
"expr": "0.0",
"name": "x",
"type": "float",
"uid": 0
},
{
"expr": "0.0",
"name": "_y",
"type": "float",
"uid": 1
},
{
"expr": "0.0",
"name": "z",
"type": "float",
"uid": 2
},
{
"expr": "45*7",
"name": "a",
"type": "float",
"uid": 3
},
{
"expr": "\u0011[__7.__2]",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 4
},
{
"expr": "\u0012fab.types.Shape('m-Xf0-Yf0-Zf0m+*f0.707107X*f-0.707107ZY+*f0.707107X*f0.707107Zm-Xf-0-Yf0-Zf-0m=(atan2( (X / -3.550000), (Z / -3.550000) )) * -3.550000;_=((sqrt( ((X / -3.550000))**2 + ((Z / -3.550000))**2 )) - 1) * -3.550000;m-Xf0-Yf0-Zf0m+*f0.848048X*f0.529919Y+*f-0.529919X*f0.848048Y_m-Xf-0-Yf-0-Zf0a-r+q-Yf1.2q-Zf0f0.5a-f-60X-Xf60',float('-5.727567'),float('-31.201508'),float('-5.727567'),float('5.727567'),float('33.236824'),float('5.727567'))",
"name": "rotated",
"type": "_fabtypes.Shape",
"uid": 5
}
],
"inspector": [
207.25594795892943,
2424.2068085247711
],
"name": "r19",
"script": [
"import fab",
"import math",
"",
"title('Rotate (Y)')",
"",
"input('x', float)",
"input('_y', float)",
"input('z', float)",
"input('a', float)",
"",
"input('shape', fab.types.Shape)",
"output('rotated', fab.shapes.rotate_y(shape, a, x, z))",
"",
"# UI",
"rad = math.radians(a)",
"sb.ui.wireframe([(x + math.cos(rad), _y, z + math.sin(rad)),",
" (x, _y, z),",
" (x + 1, _y, z)], color=sb.color.teal)",
"",
"# Draw a semi-circular arc showing the rotation",
"if int(a) % 360 != 0:",
" sb.ui.wireframe([",
" (x + math.cos(math.radians(a_)) * 0.3, _y,",
" z + math.sin(math.radians(a_)) * 0.3)",
" for a_ in range(int(a) % 360)], color=sb.color.teal)",
"",
"sb.ui.point(x, _y, z, color=sb.color.teal)",
"",
"def drag_pt(this, x, y, z):",
" this.a = math.degrees(math.atan2(z - this.z, x - this.x))",
"sb.ui.point(x + math.cos(rad), _y, z + math.sin(rad),",
" color=sb.color.teal, drag=drag_pt, relative=False)",
"",
""
],
"uid": 24
},
{
"datums": [
{
"expr": "3.2922675609588623",
"name": "x0",
"type": "float",
"uid": 0
},
{
"expr": "3.493297815322876",
"name": "y0",
"type": "float",
"uid": 1
},
{
"expr": "4.183546662330627",
"name": "x1",
"type": "float",
"uid": 2
},
{
"expr": "6.513443470001221",
"name": "y1",
"type": "float",
"uid": 3
},
{
"expr": "2.914238691329956",
"name": "x2",
"type": "float",
"uid": 4
},
{
"expr": "9.711536407470703",
"name": "y2",
"type": "float",
"uid": 5
},
{
"expr": "\u0012fab.types.Shape('ni-*f-3.02015-Xf4.18355*f-0.891279-Yf6.51344i-*f6.21824-Xf3.29227*f-0.378029-Yf3.4933-*f-3.19809-Xf2.91424*f1.26931-Yf9.71154',float('2.914239'),float('3.493298'),float('-inf'),float('4.183547'),float('9.711536'),float('inf'))",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 6
}
],
"inspector": [
747.85349920446652,
559.87585654728593
],
"name": "t0",
"script": [
"import fab",
"",
"title('Triangle')",
"",
"input('x0', float)",
"input('y0', float)",
"input('x1', float)",
"input('y1', float)",
"input('x2', float)",
"input('y2', float)",
"",
"output('shape', fab.shapes.triangle(x0, y0, x1, y1, x2, y2))",
"",
"# UI",
"sb.ui.wireframe([(x0, y0, 0), (x1, y1, 0), (x2, y2, 0)], close=True)",
"sb.ui.point(x0, y0, 0)",
"sb.ui.point(x1, y1, 0)",
"sb.ui.point(x2, y2, 0)",
""
],
"uid": 26
},
{
"datums": [
{
"expr": "\u0011[__13.__4]",
"name": "a",
"type": "_fabtypes.Shape",
"uid": 0
},
{
"expr": "\u0011[__26.__6,__27.__6]",
"name": "b",
"type": "_fabtypes.Shape",
"uid": 1
},
{
"expr": "\u0012fab.types.Shape('aaa-f2.75X-Xf3.25a-f-0.5Y-Yf7.5nini-*f-3.02015-Xf4.18355*f-0.891279-Yf6.51344i-*f6.21824-Xf3.29227*f-0.378029-Yf3.4933-*f-3.19809-Xf2.91424*f1.26931-Yf9.71154ni-*f-5.58839-Xf3.43948*f0.16482-Yf5.04931i-*f-0.526394-Xf3.6043*f-0.546044-Yf-0.539081-*f6.11478-Xf3.05825*f0.381224-Yf-1.06547',float('2.750000'),float('-0.500000'),float('-inf'),float('3.250000'),float('7.500000'),float('inf'))",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 2
}
],
"inspector": [
1148.1512130643619,
511.19099945621764
],
"name": "d1",
"script": [
"import fab.types",
"",
"title('Difference')",
"input('a', fab.types.Shape)",
"input('b', fab.types.Shape)",
"",
"output('shape', a & ~b)",
""
],
"uid": 25
},
{
"datums": [
{
"expr": "3.604296922683716",
"name": "x0",
"type": "float",
"uid": 0
},
{
"expr": "-0.5390806198120117",
"name": "y0",
"type": "float",
"uid": 1
},
{
"expr": "3.4394770860671997",
"name": "x1",
"type": "float",
"uid": 2
},
{
"expr": "5.04930579662323",
"name": "y1",
"type": "float",
"uid": 3
},
{
"expr": "3.058253049850464",
"name": "x2",
"type": "float",
"uid": 4
},
{
"expr": "-1.0654749870300293",
"name": "y2",
"type": "float",
"uid": 5
},
{
"expr": "\u0012fab.types.Shape('ni-*f-5.58839-Xf3.43948*f0.16482-Yf5.04931i-*f-0.526394-Xf3.6043*f-0.546044-Yf-0.539081-*f6.11478-Xf3.05825*f0.381224-Yf-1.06547',float('3.058253'),float('-1.065475'),float('-inf'),float('3.604297'),float('5.049306'),float('inf'))",
"name": "shape",
"type": "_fabtypes.Shape",
"uid": 6
}
],
"inspector": [
779.49121346716367,
628.02721362828436
],
"name": "t1",
"script": [
"import fab",
"",
"title('Triangle')",
"",
"input('x0', float)",
"input('y0', float)",
"input('x1', float)",
"input('y1', float)",
"input('x2', float)",
"input('y2', float)",
"",
"output('shape', fab.shapes.triangle(x0, y0, x1, y1, x2, y2))",
"",
"# UI",
"sb.ui.wireframe([(x0, y0, 0), (x1, y1, 0), (x2, y2, 0)], close=True)",
"sb.ui.point(x0, y0, 0)",
"sb.ui.point(x1, y1, 0)",
"sb.ui.point(x2, y2, 0)",
""
],
"uid": 27
}
],
"protocol": 6,
"type": "sb"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment