(*^ ::[ frontEndVersion = "Microsoft Windows Mathematica Notebook Front End Version 2.2"; microsoftWindowsStandardFontEncoding; fontset = title, "Times New Roman", 24, L0, center, nohscroll, bold; fontset = subtitle, "Times New Roman", 18, L0, center, nohscroll, bold; fontset = subsubtitle, "Times New Roman", 14, L0, center, nohscroll, italic; fontset = section, "Times New Roman", 18, L0, nohscroll, bold, grayBox; fontset = subsection, "Times New Roman", 14, L0, nohscroll, bold, blackBox; fontset = subsubsection, "Times New Roman", 13, L0, nohscroll, B65535; fontset = text, "Times New Roman", 12, L0, nohscroll, cellOutline; fontset = smalltext, "Times New Roman", 10, L0, nohscroll; fontset = input, "Courier New", 12, L-5, nowordwrap, bold; fontset = output, "Courier New", 12, L-5, nowordwrap; fontset = message, "Courier New", 12, L-5, nowordwrap, R65535; fontset = print, "Courier New", 12, L-5, nowordwrap; fontset = info, "Courier New", 12, L-5, nowordwrap, B65535; fontset = postscript, "Courier New", 12, L0, nowordwrap; fontset = name, "Arial", 10, L0, nohscroll, italic; fontset = header, "Times New Roman", 12, L0; fontset = footer, "Times New Roman", 12, L0, center; fontset = help, "Times New Roman", 10, L0, nohscroll; fontset = clipboard, "Times New Roman", 12, L0, nohscroll; fontset = completions, "Times New Roman", 12, L0, nohscroll; fontset = graphics, "Courier New", 10, L0, nowordwrap, nohscroll; fontset = special1, "Times New Roman", 12, L0, nohscroll; fontset = special2, "Times New Roman", 12, L0, nohscroll; fontset = special3, "Times New Roman", 12, L0, nohscroll; fontset = special4, "Times New Roman", 12, L0, nohscroll; fontset = special5, "Times New Roman", 12, L0, nohscroll; fontset = leftheader, "Times New Roman", 12, L2; fontset = leftfooter, "Times New Roman", 12, L2; fontset = reserved1, "Courier New", 10, L0, nowordwrap, nohscroll;] :[font = title; inactive; preserveAspect; startGroup; nohscroll; center; ] MathLive Professional :[font = subsubtitle; inactive; preserveAspect; nohscroll; center; ] Airplane example Original by L.Angrave 1996 Last Update: 20/4/96 :[font = section; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Introductory Notes :[font = subsubsection; inactive; preserveAspect; endGroup; nohscroll; ] This notebook creates a simple airplane in MathLive. Visually, it provides an insight into the Yaw Pitch and Roll notation. To ensure that the Yaw Pitch Roll correspond to something meaningful for the plane, we build the aircraft with the symmetry axis along the X axis. Run the Initialisation to execute all the cells in this notebook :[font = section; inactive; initialization; preserveAspect; startGroup; Cclosed; nohscroll; ] Initialisation :[font = input; initialization; preserveAspect; nowordwrap; backColorRed = 65535; backColorGreen = 65535; backColorBlue = 65535; fontColorRed = 0; fontColorGreen = 0; fontColorBlue = 0; bold; fontName = "Courier New"; fontSize = 12; ] *) General::spell1 //Off; General::spell //Off; Needs["Graphics`Colors`"] Needs["MathLive`MathLive`"]; (* :[font = input; initialization; preserveAspect; endGroup; nowordwrap; ] *) LaunchLive[]; ResetLive[]; (* :[font = section; inactive; initialization; preserveAspect; startGroup; Cclosed; nohscroll; ] Define the graphics :[font = input; initialization; preserveAspect; endGroup; nowordwrap; ] *) (* 4 units wide and deep. 1 unit high with the wings 0.2 units thick, at 1.5 units high *) yFront = 0; yBack = -8; yWingMid = -2; yWingHWidth = 1; zWingThickness = 0.2; zWingStart = 1.8; xWingHalfLength = 5; yBackWingLength = 1; xWing2HalfLength = 3; gPlane = Graphics3D [ { (* main body *) Hue[0],Cuboid[ { -0.5,yBack,-0.5}, {0.5,yFront,0.5} ] (* main wing *) ,Hue[.7],Cuboid[ {-xWingHalfLength,yWingMid-yWingHWidth,zWingStart} , {xWingHalfLength,yWingMid+yWingHWidth,zWingStart+zWingThickness} ] (* back wing *) ,Hue[.2],Cuboid[ {-xWing2HalfLength,yBack,-0.1} , {xWing2HalfLength,yBack + yBackWingLength,0.1}] (* Rudder *) ,Hue[.3],Cuboid[ { 0.1, yBack,0} , {-0.1, yBack + yBackWingLength, zWingStart}] (* struts to the main wing *) ,Hue[0], Line[ { { 0.3 xWingHalfLength, yWingMid-0.3 yWingHWidth,zWingStart} , { 0 , yWingMid,0} , { 0.3 xWingHalfLength, yWingMid+0.3 yWingHWidth,zWingStart} }] , Line[ { { -0.3 xWingHalfLength , yWingMid-0.3 yWingHWidth, zWingStart} , { 0 , yWingMid ,0} , { -0.3 xWingHalfLength , yWingMid+0.3 yWingHWidth, zWingStart} }] }]; (* :[font = section; inactive; initialization; preserveAspect; startGroup; Cclosed; nohscroll; ] Create the airplane :[font = input; initialization; preserveAspect; endGroup; nowordwrap; ] *) Live[ Change[Model3D["Default`"] , ModelRange-> 6{{-1,1},{-1,1},{-1,1}} ] ]; Live[ Create[Object3D["Plane"], gPlane ] ]; Live[ Change[Object3D["Plane"], PointOfRotation ->{0,0,0} ] ]; (* :[font = section; inactive; initialization; preserveAspect; startGroup; Cclosed; nohscroll; ] Animations :[font = subsection; inactive; initialization; preserveAspect; startGroup; Cclosed; nohscroll; ] Yaw for the Heading :[font = input; initialization; preserveAspect; endGroup; nowordwrap; ] *) anim = Table[{ Change[Object3D["Plane"] , YawPitchRoll-> {2 Pi t , 0 , 0} , Location -> {0,0,0} ]} , {t,0,1,1/40} ]; Live[ anim ]; (* :[font = subsection; inactive; initialization; preserveAspect; startGroup; Cclosed; nohscroll; ] Pitch for the landing :[font = input; initialization; preserveAspect; endGroup; nowordwrap; ] *) pitchAngle = 15 Degree; anim = Table[ Change[Object3D["Plane"] , YawPitchRoll-> {0, pitchAngle,0} , Location -> {0,Cos[pitchAngle],Sin[pitchAngle]}30t ] , {t,0,1,1/40} ]; Live[ anim ]; (* :[font = subsection; inactive; initialization; preserveAspect; startGroup; Cclosed; nohscroll; ] Victory roll and fly past :[font = input; initialization; preserveAspect; endGroup; nowordwrap; ] *) anim = Table[ Change[Object3D["Plane"] , YawPitchRoll-> {Pi/2 (*Eastward*),0.,2 Pi t} , Location -> {20(t-.2) ,0,0} ] , {t,0,1,1/40} ]; Live[ anim ]; (* :[font = subsection; inactive; initialization; preserveAspect; startGroup; Cclosed; nohscroll; ] Yaw Pitch Roll for the Camera :[font = input; initialization; preserveAspect; endGroup; nowordwrap; ] *) (* Roll the camera around once and slowly increase the elevation *) anim = Table[ Change[Camera["Camera"] , YawPitchRoll-> {0,Pi/16 t,2 Pi t} , Location -> {0,-4+ 4 t,0} ] , {t,0,1,1/40} ]; Live[ anim ]; (* :[font = subsection; inactive; initialization; preserveAspect; startGroup; Cclosed; nohscroll; ] Fly around :[font = input; initialization; preserveAspect; nowordwrap; ] *) direction[yaw_,pitch_] := { Cos[pitch] Sin[yaw] , Cos[pitch] Cos[yaw] , Sin[pitch] }; (* :[font = input; initialization; preserveAspect; nowordwrap; ] *) Live[ { Reset[ Object3D["Plane"] ] , Reset[ Camera["Camera"] ] }]; (* :[font = input; initialization; preserveAspect; endGroup; endGroup; nowordwrap; ] *) location = {0,0,0}; yaw = -0.7; pitch=0; roll=0; anim= Table[ roll += 0.09; pitch = 0.2 Sin[ 0.075 t ] + 0.2 Sin[ 0.07 t]; yaw += 0.17; location += direction[yaw,pitch]; Change[Object3D["Plane"] , Location -> location , YawPitchRoll -> {yaw,pitch,roll}] , {t,80} ]; Live[ anim] (* :[font = section; inactive; preserveAspect; startGroup; nohscroll; ] For further information, advice or suggestions please contact- :[font = text; inactive; preserveAspect; endGroup; endGroup; nohscroll; cellOutline; backColorRed = 65535; backColorGreen = 65535; backColorBlue = 65535; fontColorRed = 0; fontColorGreen = 0; fontColorBlue = 0; plain; fontName = "Times"; fontSize = 12; ] Email: support@milohedge.com Post: Milo Hedge Ltd, The Oxford Centre for Innovation, Mill Street, Oxford, OX2 0JX WWW: http://www.milohedge.com/mathlive/ ^*)