Sharedsupport / 2015-11-18-robot.sagewsOpen in CoCalc
Authors: Harald Schilly, ℏal Snyder, William A. Stein
License: GNU General Public License v3.0
Description: Examples for support purposes.
# (From Collin Giguere) import sage.plot.plot3d.implicit_plot3d def implicit_plot3d(*args, **kwds): kwds['plot_points'] = 20 return sage.plot.plot3d.implicit_plot3d.implicit_plot3d(*args, **kwds) var('x,y,z,t,r,theta') #Meet "Name him Bob"! (Name credits to Kaitlyn Pajer). #Body Parts: body = cube(color='gray', frame_thickness=3, frame_color='black', size=6) Rarm = implicit_plot3d((.5==y^2+z^2), (x, 3, 8), (y, -sqrt(.5), sqrt(.5)), (z, -sqrt(.5), sqrt(.5)), color='gray') Larm = implicit_plot3d((.5==y^2+z^2), (x, -3, -8), (y, -sqrt(.5), sqrt(.5)), (z, -sqrt(.5), sqrt(.5)), color='gray') neck = implicit_plot3d((.3==x^2+y^2), (x, -15, 15), (y, -15, 15), (z, 3, 5), color='gray') head = cube(center=(0, 0, 7.5), color='gray', frame_color='black', frame_thickness=3, size=5) Rleg = implicit_plot3d((.5==(x+1.5)^2+y^2), (x, -sqrt(.5), sqrt(.5)), (y, -sqrt(.5), sqrt(.5)), (z, -12, -3), color='gray') Lleg = implicit_plot3d((.5==(x-1.5)^2+y^2), (x, -sqrt(.5), sqrt(.5)), (y, -sqrt(.5), sqrt(.5)), (z, -12, -3), color='gray') Rear = implicit_plot3d((.4==y^2+(z-7.5)^2), (x, -3.5, -2.5), (y, -15, 15), (z, -15, 15), color='black') Lear = implicit_plot3d((.4==y^2+(z-7.5)^2), (x, 2.5, 3.5), (y, -15, 15), (z, -15, 15), color='black') Rear2 = implicit_plot3d((1==((z-7.5)^2)/1.5+y^2+(x+4.2)^2), (x, -15, 15), (y, -15, 15), (z, -15, 15), color='red') Lear2 = implicit_plot3d((1==((z-7.5)^2)/1.5+y^2+(x-4.2)^2), (x, -15, 15), (y, -15, 15), (z, -15, 15), color='red') Rant = parametric_plot3d((-(t-1.5), 0, -2*t+10), (t, -1.5, 0), color='black', thickness=5) Lant = parametric_plot3d((-t-1.5, 0, 2*t+10), (t, 0, 1.5), color='black', thickness=5) Rhand = implicit_plot3d((.5==(z^2)/6+y^2+((x+8.5)^2)/6), (x, -15, 15), (y, -15, 15), (z, -15, 15), color='gray') Lhand = implicit_plot3d((.5==(z^2)/6+y^2+((x-8.5)^2)/6), (x, -15, 15), (y, -15, 15), (z, -15, 15), color='gray') Rfoot = implicit_plot3d((1==sqrt((x+1.5)^2+((y-1)^2)/9+(z+12)^2)), (x, -15, 15), (y, -15, 15), (z, -15, 15), color='gray') Lfoot = implicit_plot3d((1==sqrt((x-1.5)^2+((y-1)^2)/9+(z+12)^2)), (x, -15, 15), (y, -15, 15), (z, -15, 15), color='gray') #Rings; #Arms: ring = plot3d((sqrt(.55-y^2)), (x, 3, 3.2), (y, -sqrt(.55), sqrt(.55)), color='black') ring1 = plot3d((-sqrt(.55-y^2)), (x, 3, 3.2), (y, -sqrt(.55), sqrt(.55)), color='black') ring2 = implicit_plot3d((.55==y^2+z^2), (x, 5/4+3, 5/4+3.2), (y, -sqrt(.55), sqrt(.55)), (z, -sqrt(.55), sqrt(.55)), color='black') ring3 = implicit_plot3d((.55==y^2+z^2), (x, 10/4+3, 10/4+3.2), (y, -sqrt(.55), sqrt(.55)), (z, -sqrt(.55), sqrt(.55)), color='black') ring4 = implicit_plot3d((.55==y^2+z^2), (x, 15/4+3, 15/4+3.2), (y, -sqrt(.55), sqrt(.55)), (z, -sqrt(.55), sqrt(.55)), color='black') ring5 = implicit_plot3d((.55==y^2+z^2), (x, -3, -3.2), (y, -sqrt(.55), sqrt(.55)), (z, -sqrt(.55), sqrt(.55)), color='black') ring6 = implicit_plot3d((.55==y^2+z^2), (x, -5/4-3, -5/4-3.2), (y, -sqrt(.55), sqrt(.55)), (z, -sqrt(.55), sqrt(.55)), color='black') ring7 = implicit_plot3d((.55==y^2+z^2), (x, -10/4-3, -10/4-3.2), (y, -sqrt(.55), sqrt(.55)), (z, -sqrt(.55), sqrt(.55)), color='black') ring8 = implicit_plot3d((.55==y^2+z^2), (x, -15/4-3, -15/4-3.2), (y, -15, 15), (z, -sqrt(.55), sqrt(.55)), color='black') #Legs: ring9 = implicit_plot3d((.55==(x+1.5)^2+y^2), (x, -sqrt(.55), sqrt(.55)), (y, -sqrt(.55), sqrt(.55)), (z, -3.2, -3), color='black') ring10 = implicit_plot3d((.55==(x+1.5)^2+y^2), (x, -sqrt(.55), sqrt(.55)), (y, -sqrt(.55), sqrt(.55)), (z, -3.2-9/7, -3-9/7), color='black') ring11 = implicit_plot3d((.55==(x+1.5)^2+y^2), (x, -sqrt(.55), sqrt(.55)), (y, -sqrt(.55), sqrt(.55)), (z, -3.2-18/7, -3-18/7), color='black') ring12 = implicit_plot3d((.55==(x+1.5)^2+y^2), (x, -sqrt(.55), sqrt(.55)), (y, -sqrt(.55), sqrt(.55)), (z, -3.2-27/7, -3-27/7), color='black') ring13 = implicit_plot3d((.55==(x+1.5)^2+y^2), (x, -sqrt(.55), sqrt(.55)), (y, -sqrt(.55), sqrt(.55)), (z, -3.2-36/7, -3-36/7), color='black') ring14 = implicit_plot3d((.55==(x+1.5)^2+y^2), (x, -sqrt(.55), sqrt(.55)), (y, -sqrt(.55), sqrt(.55)), (z, -3.2-45/7, -3-45/7), color='black') ring15 = implicit_plot3d((.55==(x+1.5)^2+y^2), (x, -sqrt(.55), sqrt(.55)), (y, -sqrt(.55), sqrt(.55)), (z, -3.2-54/7, -3-54/7), color='black') ring16 = implicit_plot3d((.55==(x-1.5)^2+y^2), (x, -sqrt(.55), sqrt(.55)), (y, -sqrt(.55), sqrt(.55)), (z, -3.2, -3), color='black') ring17 = implicit_plot3d((.55==(x-1.5)^2+y^2), (x, -sqrt(.55), sqrt(.55)), (y, -sqrt(.55), sqrt(.55)), (z, -3.2-9/7, -3-9/7), color='black') ring18 = implicit_plot3d((.55==(x-1.5)^2+y^2), (x, -sqrt(.55), sqrt(.55)), (y, -sqrt(.55), sqrt(.55)), (z, -3.2-18/7, -3-18/7), color='black') ring19 = implicit_plot3d((.55==(x-1.5)^2+y^2), (x, -sqrt(.55), sqrt(.55)), (y, -sqrt(.55), sqrt(.55)), (z, -3.2-27/7, -3-27/7), color='black') ring20 = implicit_plot3d((.55==(x-1.5)^2+y^2), (x, -sqrt(.55), sqrt(.55)), (y, -sqrt(.55), sqrt(.55)), (z, -3.2-36/7, -3-36/7), color='black') ring21 = implicit_plot3d((.55==(x-1.5)^2+y^2), (x, -sqrt(.55), sqrt(.55)), (y, -sqrt(.55), sqrt(.55)), (z, -3.2-45/7, -3-45/7), color='black') ring22 = implicit_plot3d((.55==(x-1.5)^2+y^2), (x, -sqrt(.55), sqrt(.55)), (y, -sqrt(.55), sqrt(.55)), (z, -3.2-54/7, -3-54/7), color='black') #Neck: ring23 = implicit_plot3d((.35==x^2+y^2), (x, -sqrt(.35), sqrt(.35)), (y, -sqrt(.35), sqrt(.35)), (z, 3, 3.2), color='black') ring24 = implicit_plot3d((.35==x^2+y^2), (x, -sqrt(.35), sqrt(.35)), (y, -sqrt(.35), sqrt(.35)), (z, 3.9, 4.1), color='black') ring25 = implicit_plot3d((.35==x^2+y^2), (x, -sqrt(.35), sqrt(.35)), (y, -sqrt(.35), sqrt(.35)), (z, 4.8, 5), color='black') #Face: Reye = parametric_plot3d((cos(t)+1.2, 2.6, sin(t)+8.6), (t, 0, 2*pi), color='black', thickness=3) Leye = parametric_plot3d((cos(t)-1.2, 2.6, sin(t)+8.6), (t, 0, 2*pi), color='black', thickness=3) Reye2 = parametric_plot3d((r*sin(theta)+1.2, 2.6, r*cos(theta)+8.6), (r, 0, .9), (theta, 0, 2*pi), color='white') Leye2 = parametric_plot3d((r*sin(theta)-1.2, 2.6, r*cos(theta)+8.6), (r, 0, .9), (theta, 0, 2*pi), color='white') Reye3 = parametric_plot3d((r*sin(theta)+1.2, 2.7, r*cos(theta)+8.6), (r, 0, .3), (theta, 0, 2*pi), color='black') Leye3 = parametric_plot3d((r*sin(theta)-1.2, 2.7, r*cos(theta)+8.6), (r, 0, .3), (theta, 0, 2*pi), color='black') Mouth = parametric_plot3d((t, 2.6 ,(1/3)*t^2+5.8), (t, -2.2, 2.2), color='black', thickness=3, spin=2) #Put it all together: body + Rarm + Larm + neck + head + Rleg + Lleg + Rear + Lear + Rear2 + Lear2 + Rant + Lant + Rhand + Lhand + Rfoot + Lfoot + ring + ring1 + ring2 + ring3 + ring4 + ring5 + ring6 + ring7 + ring8 + ring9 + ring10 + ring11 + ring12 + ring13 + ring14 + ring15 + ring16 + ring17 + ring18 + ring19 + ring20 + ring21 + ring22 + ring23 + ring24 + ring25 + Reye + Leye + Reye2 + Leye2 + Reye3 + Leye3 + Mouth
(x, y, z, t, r, theta)
3D rendering not yet implemented