(*^ ::[ frontEndVersion = "Microsoft Windows Mathematica Notebook Front End Version 2.2"; microsoftWindowsStandardFontEncoding; fontset = title, "Times", 24, L0, center, nohscroll, bold; fontset = subtitle, "Times", 18, L0, center, nohscroll, bold; fontset = subsubtitle, "Times", 14, L0, center, nohscroll, italic; fontset = section, "Times", 18, L0, nohscroll, bold, grayBox; fontset = subsection, "Times", 14, L0, nohscroll, bold, blackBox; fontset = subsubsection, "Times", 13, L0, nohscroll, B32896; fontset = text, "Times", 12, L0, nohscroll, cellOutline; fontset = smalltext, "Times", 10, L0, nohscroll; fontset = input, "Courier", 12, L-4, nowordwrap, bold; fontset = output, "Courier", 12, L-4, nowordwrap; fontset = message, "Courier", 12, L-4, nowordwrap, R32896; fontset = print, "Courier", 12, L-4, nowordwrap; fontset = info, "Courier", 12, L-4, nowordwrap, B32896; fontset = postscript, "Courier", 12, L0, nowordwrap; fontset = name, "Geneva", 10, L0, nohscroll, italic; fontset = header, "Times", 12, L0; fontset = footer, "Times", 12, L0, center; fontset = help, "Times", 10, L0, nohscroll; fontset = clipboard, "Times", 12, L0, nohscroll; fontset = completions, "Times", 12, L0, nohscroll; fontset = graphics, "Courier New", 10, L0, nowordwrap, nohscroll; fontset = special1, "Times", 12, L0, nohscroll; fontset = special2, "Times", 12, L0, nohscroll; fontset = special3, "Times", 12, L0, nohscroll; fontset = special4, "Times", 12, L0, nohscroll; fontset = special5, "Times", 12, L0, nohscroll; fontset = leftheader, "Times", 12, L2; fontset = leftfooter, "Times", 12, L2; fontset = reserved1, "Courier New", 10, L0, nowordwrap, nohscroll;] :[font = title; inactive; preserveAspect; nohscroll; center; ] MathLive Professional :[font = subsubsection; inactive; preserveAspect; nohscroll; ] This tutorial covers the complete functionality of MathLive Professional using short examples to illustrate each point. We have supplied a Troubleshooting notebook which you should look at if things do not seem to work the way we have described. MathLive, once mastered is very straightforward in use, but can be slightly daunting for users unfamiliar with 3D concepts and terms. However we are highly approachable and if there are any problems which remain after reading the various notebooks, feel free to drop us an email or letter and we'll get back to you quickly. :[font = section; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] MathLive Control Commands :[font = subsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Setting Up... :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] To include MathLive Professional in your Mathematica session you will need to include the Mathematica definitions that control MathLive, and start the MathLive application. :[font = input; preserveAspect; endGroup; nowordwrap; ] Needs["MathLive`MathLive`"] :[font = subsubsection; inactive; preserveAspect; nohscroll; ] You should see a message similar to- :[font = output; inactive; nowordwrap; ] Starting MathLive Pro Package (Version 1.00) :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] How you launch and connect to the MathLive will depend on your system, whether your Kernel is running locally, and what protocols are used to connect to MathLive. Setting this up initially can be tricky, but should only need to be done once. You will need to tell the Kernel whether it should attempt to launch MathLive (appropriate if you are running on a local machine) or connect to a copy of MathLive that has been started manually. (appropriate if you running the Kernel over a network, or have started MathLive for another reason). :[font = input; preserveAspect; nowordwrap; ] LaunchLive[] :[font = input; preserveAspect; endGroup; nowordwrap; ] ConnectLive[] :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] LaunchLive and ConnectLive use $LivePath and $LiveConnectName respectively to attempt to launch or connect to MathLive. Feel free to change these. On a Macintosh running the kernel and MathLive locally, no changes are necessary and you can skip the rest of this section! :[font = input; preserveAspect; startGroup; Cclosed; nowordwrap; ] $LivePath $LiveConnectName :[font = output; inactive; formatted; output; nowordwrap; ] Automatic ;[o] Automatic :[font = output; inactive; formatted; output; endGroup; endGroup; nowordwrap; ] "mlpro.exe" ;[o] mlpro.exe :[font = input; startGroup; Cclosed; nowordwrap; ] ?LaunchLive :[font = print; inactive; formatted; output; endGroup; nowordwrap; ] LaunchLive[] will launch Live and connect it to the kernel. If no name is supplied, LaunchLive uses $LivePath ;[o] LaunchLive[] will launch Live and connect it to the kernel. If no name is supplied, LaunchLive uses $LivePath :[font = subsubsection; inactive; preserveAspect; nohscroll; backColorRed = 65535; backColorGreen = 65535; backColorBlue = 65535; fontColorRed = 0; fontColorGreen = 0; fontColorBlue = 32896; plain; fontName = "Times"; fontSize = 13; ] To override the default behaviour, specify a new name in Launch or ConnectLive, for example :[font = input; preserveAspect; nowordwrap; ] LaunchLive["'C:\AnotherProgram'", LinkName->"1088", LinkProtocol->"TCP] :[font = input; preserveAspect; nowordwrap; ] ConnectLive["MLP123"] :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] MathLink options can also be supplied if required. See your mathlink manual "LinkOpen" for more information. For example, to use TCP protocol across a network, you might use- :[font = input; preserveAspect; endGroup; nowordwrap; ] ConnectLive["MLP123", LinkProtocol->"TCP", LinkHost -> "Tim.Ber.Land.edu"] :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Both LaunchLive and ConnectLive use "StartLive" which uses LinkOpen to attempt to open the mathlink connection. The above options could be set as the default options by :[font = input; preserveAspect; endGroup; nowordwrap; ] (* Commented out - You don`t really want to connect to Timberland University? *) (* SetOptions[ StartLive, LinkProtocol -> "TCP" , LinkHost->"Tim.Ber.Land.edu" ]; *) :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Once configured, you should be able to start or connect to MathLive with a simple call to LaunchLive or ConnectLive respectively. :[font = input; preserveAspect; endGroup; nowordwrap; backColorRed = 65535; backColorGreen = 65535; backColorBlue = 65535; fontColorRed = 0; fontColorGreen = 0; fontColorBlue = 0; plain; fontName = "Courier"; fontSize = 12; ] Needs["MathLive`MathLive`"] LaunchLive[] (* All the hard work of network options carefully hidden! *) :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] LaunchLive and ConnectLive print a connection message when succesful and return True. In Mathematica 2.x TCP connections are used and in Mathematica 3.x, file mapping connections are used. If unsucessful they return $Failed. If things are working correctly you should expect to see a message similar to :[font = print; inactive; preserveAspect; endGroup; nowordwrap; ] Starting MathLive Pro Package (Version 1.00) :[font = subsubsection; inactive; preserveAspect; nohscroll; ] the first time you run the MathLive package and :[font = print; inactive; formatted; output; nowordwrap; ] Connected to MathLive Professional for Windows ;[o] Connected to MathLive Professional for Windows :[font = subsubsection; inactive; preserveAspect; endGroup; nohscroll; ] when you connect to the application. :[font = subsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] CloseLive :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] To quit MathLive, and to close the link, use :[font = input; preserveAspect; endGroup; nowordwrap; ] CloseLive[] :[font = subsubsection; inactive; preserveAspect; endGroup; nohscroll; ] This will send a "terminate" message to the MathLive and will then close the link. :[font = subsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Live Application Details :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] When a valid link is made to MathLive, the kernel will ask MathLive for its version information. (This information is shown on the screen when the link is established). You can interrogate MathLive yourself using LiveApplicationDetails :[font = input; preserveAspect; startGroup; Cclosed; nowordwrap; ] Needs["MathLive`MathLive`"] LaunchLive[] :[font = print; inactive; formatted; output; nowordwrap; ] Connected to MathLive Professional for Windows ;[o] Connected to MathLive Professional for Windows :[font = output; inactive; formatted; output; endGroup; nowordwrap; ] True ;[o] True :[font = input; preserveAspect; startGroup; Cclosed; nowordwrap; ] LiveApplicationDetails[] :[font = output; inactive; formatted; output; endGroup; endGroup; endGroup; nowordwrap; ] {"MathLive Professional for Windows", 1.01, "19960915", "", "", "", 0., 0.} ;[o] {MathLive Professional for Windows, 1.01, 19960915, , , , 0., 0.} :[font = subsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Set Display :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] This affects Plot3D and other graphing functions that attempt to produce graphical output each time they are executed. SetDisplay has been covered more thoroughly in the introductory notebook. :[font = input; preserveAspect; nowordwrap; ] SetDisplay[ (NoteBook -> True/On/False/Off) , (Live -> True/On/False/Off) ] :[font = input; preserveAspect; endGroup; endGroup; endGroup; nowordwrap; ] (* Has no effect on current settings *) SetDisplay[] (* Turns off automatic graphic output in the FrontEnd NoteBook*) SetDisplay[NoteBook -> Off] (* Turns on Live output *) SetDisplay[Live->On];SetDisplay[Live->True] (*Turn on Live and Turn off the notebook *) SetDisplay[Live->On, NoteBook ->Off] :[font = section; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Live[ ... ] Commands :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Commands are sent to MathLive using the Live command. :[font = input; preserveAspect; endGroup; nowordwrap; ] Needs["MathLive`MathLive`"] LaunchLive[] :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] In Mathematica 2.2.x, it is not possible to send error messages back to the Mathematica Messages Box. If MathLive sees something it cannot understand it will display a brief summary of the problem. You may like to try :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Complain! ]; CloseLive[]; :[font = subsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Create and destroy models and objects :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Let's get down to business of creating our first real model. We will populate MathLive with ten cubes. :[font = input; preserveAspect; startGroup; Cclosed; nowordwrap; ] Needs["MathLive`MathLive`"]; LaunchLive[]; :[font = print; inactive; formatted; output; endGroup; nowordwrap; ] Connected to MathLive Professional for Windows ;[o] Connected to MathLive Professional for Windows :[font = input; preserveAspect; startGroup; Cclosed; nowordwrap; ] nCubes = 10; length = 10; (* The dimensions of our box *) Do[ xyz = length { cube / nCubes , cube / nCubes , Random[]}; Live[ Graphics3D[ Cuboid[ xyz ] ] ]; , {cube,nCubes} ]; :[font = message; inactive; formatted; output; endGroup; endGroup; nowordwrap; ] General::spell1: Possible spelling error: new symbol name "length" is similar to existing symbol "Length". ;[o] General::spell1: Possible spelling error: new symbol name "length" is similar to existing symbol "Length". :[font = input; preserveAspect; nowordwrap; backColorRed = 65535; backColorGreen = 65535; backColorBlue = 65535; fontColorRed = 0; fontColorGreen = 0; fontColorBlue = 0; bold; fontName = "Courier"; fontSize = 12; ] nCubes = 10; length = 10; (* The dimensions of our box *) Do[ xyz = length { cube / nCubes , cube / nCubes , Random[]}; Live[ Graphics3D[ Cuboid[ xyz ] ] ]; , {cube,4,10}] :[font = subsubsection; inactive; preserveAspect; nohscroll; ] Each time a new object is created, the model coordinate range may expand to fit the new objects in. Initially, only one cube exists - so it occupies the entire model range. As new cubes are added, the model range expands and the existing cubes shrink. :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] We can determine the current model range using- :[font = input; preserveAspect; endGroup; nowordwrap; ] ModelRange[Model3D["Default`"] ] :[font = subsubsection; inactive; preserveAspect; nohscroll; ] The first paired values represent the minimum and maximum X values, the second pair the Y values and the final pair, the Z axis. You will notice that the difference between the minimum and maximum is the same in each case. This is necessary to ensure that individual object rotations work correctly when there is more than one object in the model. :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Each cube is a separate object . You can illustrate this by clicking on each in turn, and then by moving the mouse before releasing it, each can be set spinning independently. Each one has a name too :[font = input; preserveAspect; endGroup; nowordwrap; ] ObjectList[ Model3D["Default`"] ] (* Execute this! *) :[font = subsubsection; inactive; preserveAspect; nohscroll; ] Every object in MathLive is given a name when it is created. In this case it was generated automatically by MathLive though we will see later how to explicitly name objects. :[font = subsubsection; inactive; preserveAspect; nohscroll; ] A better display method is tell MathLive what we expect the Model Range to be before we start creating objects. :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] To start afresh, we should destroy the objects in the model. We could do this with :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Destroy /@ ObjectList[ Model3D["Default`"] ] ]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] This has destroyed all the cubes, but has left the modelRange unchanged- :[font = input; preserveAspect; startGroup; Cclosed; nowordwrap; ] ModelRange[Model3D["Default`"] ] :[font = output; inactive; formatted; output; endGroup; endGroup; nowordwrap; ] {{-1.5587, 11.000}, {-1.5587, 11.000}, {-1.1545, 11.404}} ;[o] {{-1.5587, 11.}, {-1.5587, 11.}, {-1.1545, 11.404}} :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] A better way to destroy the contents of the model is to destroy the model itself! :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Destroy[ Model3D["Default`"] ] ]; ModelRange[Model3D["Default`"] ] :[font = subsubsection; inactive; preserveAspect; nohscroll; ] (Actually, you're not allowed to destroy the default model completely.) :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] This time we'll create our own independent model for our cubes :[font = input; preserveAspect; nowordwrap; ] Live[ Create[ Model3D["Cubes`"] ] ]; :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Model3D["Cubes`"] , ModelRange -> {{-5,20},{-5,20},{-5,20}} ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] We can of course check our model range at any time :[font = input; preserveAspect; startGroup; Cclosed; nowordwrap; ] ModelRange[Model3D["Cubes`"] ] :[font = output; inactive; formatted; output; endGroup; endGroup; nowordwrap; ] {{-5.000, 20.000}, {-5.000, 20.000}, {-5.000, 20.000}} ;[o] {{-5., 20.}, {-5., 20.}, {-5., 20.}} :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Let's put all our cuboids into a single 3D graphic this time- :[font = input; preserveAspect; endGroup; nowordwrap; ] cuboidGraphics = Graphics3D[ Table[ xyz = length { cube / nCubes , cube / nCubes , Random[]}; Cuboid[ xyz ] , {cube,nCubes} ] ]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Now we create our cubes object (called "cuboids") in the Cube model- :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Create[Object3D["Cubes`cuboids"] , cuboidGraphics ]] ; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Time to clean up the output. First, Let's hide the default model. There are two ways to do this. Firstly from the MathLive Preferences menu, and secondly, from Mathematica. :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Model3D["Default`"] , BoundingBox-> Off ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] We can turn off the bounding box of our model with :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Model3D["Cubes`"] , BoundingBox-> Off ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Finally, to destroy the our model we can either use the relevant mouse-key combinations in MathLive, or :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Destroy[ Model3D["Cubes`"] ] ]; :[font = subsubsection; inactive; preserveAspect; endGroup; nohscroll; ] Using models other than the default model becomes useful when you want to use the default model as a 'scratch space'. Many models other than the default model can coexist and have very different model scales. The model bounding box can be a very useful tool to quickly rotate all the objects together. Objects in the default model do not need to be prefaced with "Default`". :[font = subsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Translate, Locate and Animate :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] We can create objects and models, we can move them around and create animations. When a list is sent to MathLive it is treated as animation. Each element is executed before displaying the scene- :[font = input; inactive; preserveAspect; endGroup; nowordwrap; ] Live[ { Things to do for the first frame , 2nd frame , 3rd frame etc... }] :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] To illustrate this we create an object and then move it. :[font = input; preserveAspect; nowordwrap; ] Plot3D[ Arg[ Log[ x + I y] ] , {x,-3,3},{y,-3,3} , DisplayFunction-> Live , ColorFunction-> Hue ]; surface = LastObjectCreated[] :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ { Translate[ surface , {1,0,0} ] , Translate[ surface , {1,0,0} ] , Translate[ surface , {1,0,0} ] }]; Live[ { Translate[ surface ,-{1,0,0} ] , Translate[ surface ,-{1,0,0} ] , Translate[ surface ,-{1,0,0} ] }]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Notice that Translate provides relative movement, and importantly, the movement is scaled by the modelRange, the unit length of the model will correspond to -3 -> +3 ). Absolute movements can be specified using :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Locate[ surface , {1,1,1} ] ]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] or equivalently, :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ surface, Location -> {1,1,1} ] ]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] To create an animation it is often useful to do this in two steps. First we create a table of the animation frames. In each animation frame we move the surface and model . :[font = input; startGroup; Cclosed; nowordwrap; ] surface :[font = output; inactive; formatted; output; endGroup; nowordwrap; ] Object3D["Object 2"] ;[o] Object3D[Object 2] :[font = input; preserveAspect; endGroup; nowordwrap; ] animation = Table[ { Locate[ surface , {Cos[i] ,0,0} ] , Locate[ Model3D["Default`"] , 0.2{0,0,Sin[i]} ] } , {i, 0., 2. Pi , 2. Pi / 20 } ]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] This can be sent to MathLive :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ animation ]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Animations can be repeated from MathLive by selecting 'Repeat Last Animation' under the Edit menu, or alternatively by re-sending the animation data from Mathematica. On Macintosh systems we can also create a Quicktime movie using the animation list :[font = input; preserveAspect; endGroup; endGroup; nowordwrap; ] Live[ RecordMovie["MyFirstMovie.qt", animation ] ]; :[font = subsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] FaceForm :[font = subsubsection; inactive; preserveAspect; nohscroll; ] In MathLive it is possible to create single sided polygons that are completely transparent when viewed from one direction. This can be useful to view the inside of an object. :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] To specify that polygons only have a front surface use :[font = input; inactive; preserveAspect; endGroup; nowordwrap; ] FaceForm[ color, None ] :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] And for a back surface use :[font = input; inactive; preserveAspect; endGroup; nowordwrap; ] FaceForm[ None , color ] :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] In this context "Null" can be used interchangeably with "None". Their presence will prevent the polygon surface from being created, so the following is perfectly valid and prevent the back surfaces from being created. :[font = input; inactive; preserveAspect; endGroup; nowordwrap; ] FaceForm[ Hue[0] , ] :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Finally here's an example- :[font = input; preserveAspect; startGroup; Cclosed; nowordwrap; ] Needs["Graphics`Polyhedra`"]; Needs["MathLive`MathLive`"]; LaunchLive[]; :[font = print; inactive; formatted; output; endGroup; nowordwrap; ] Connected to MathLive Professional for Windows ;[o] Connected to MathLive Professional for Windows :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Create[ Object3D["Icos"] , Graphics3D[{ FaceForm[ None, RGBColor[1,0,0]] , Octahedron[] }]]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The shape will look fairly normal until you attempt to rotate it- the inside appears to rotate in the wrong direction! In fact you are looking at the back half of the icosahedron. When a face is rotated to the front it becomes transparent. :[font = input; preserveAspect; endGroup; endGroup; nowordwrap; ] CloseLive[] :[font = subsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Thickness and PointSize :[font = subsubsection; inactive; preserveAspect; nohscroll; ] Thickness and PointSize are treated as a fraction of the object's size. This will give similar (but not necessarily) identical results to Mathematica. :[font = subsubsection; inactive; preserveAspect; endGroup; endGroup; nohscroll; ] It is not yet possible to produce lines of an absolute size. For the moment, AbsoluteThickness is treated as Thickness and AbsolutePointSize is treated as PointSize. :[font = section; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Enquiry Functions :[font = subsubsection; inactive; preserveAspect; nohscroll; ] Enquiry functions are executed immediately and return information about the state of MathLive. They do not need to be wrapped in Live[ ... ] :[font = subsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] CurrentObjectTouched[], LastObjectCreated[], LastObjectTouched[] :[font = subsubsection; inactive; preserveAspect; nohscroll; ] CurrentObjectTouched and LastObjectTouched are useful to determine the name of a specific object, and manipulating objects under mouse/Kernel control. :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] LastObjectCreated is useful when creating objects in MathLive that have been implicitly named. For example :[font = input; preserveAspect; nowordwrap; ] Needs["MathLive`MathLive`"]; LaunchLive[]; SetDisplay[ Live -> True, NoteBook -> False]; Plot3D[ Cos[x] Sin[y] , {x,-2,2},{y,-2,2}]; :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ LastObjectCreated[] , RenderMode-> SmoothShaded , PointOfRotation -> Centre , Color -> {{Hue[0.], Hue[-.2] }} ] ]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] This little program will change the color of the object that has been selected, until the user clicks on the camera icon. :[font = input; preserveAspect; nowordwrap; ] Live[ Change[ Camera["Camera"] , Visible -> True ] ]; :[font = input; preserveAspect; endGroup; endGroup; nowordwrap; ] While[ Head[ object= CurrentObjectTouched[] ] =!= Camera , If[ object =!= None, Live[Change[ object , Color -> Hue[Random[]] ]]; ] ]; Print["The Camera is selected so I'm stopping"]; :[font = subsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] ObjectList [ Model3D[ "myModel`" ] ] :[font = subsubsection; inactive; preserveAspect; endGroup; nohscroll; ] ObjectList returns the complete list of objects in the model. The first object reference is the earliest object that was created and still exists. If no objects exist in the model, this function returns None. See the section 'Creating Objects' for more information. :[font = subsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] ModelRange [ Model3D[ "myModel`" ] ] :[font = subsubsection; inactive; preserveAspect; endGroup; endGroup; nohscroll; ] ModelRange returns the coordinate range represented by a specific model. See "Object Creation" for an example. :[font = section; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Object Attributes Live[ Change[ reference , options]] :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Once an object exists in MathLive, it can be manipulated. The normal method of doing this involves use of the Change command :[font = input; inactive; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ myObject , attribute -> newValue ] ] :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] To illustrate the possible effects, let us first create a simple object :[font = input; preserveAspect; endGroup; nowordwrap; ] Needs["MathLive`MathLive`"]; LaunchLive[]; SetDisplay[ NoteBook -> Off, Live->Off]; Live[ Create[ Object3D["surface"] , Plot3D[ Cos[x + y - x y ] , {x,-1,1},{y,-1,1} , ColorFunction -> Hue , PlotPoints-> 20 ] ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The surface light properties can be changed Specular -> number 0...1 Ambient -> number 0...1 Diffuse -> number 0...1 :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Object3D["surface"] , Ambient -> 0.1 , Specular -> 0.0 , Diffuse -> 0.7 ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The surface can be made opaque or transparent Opacity -> number 0...1 :[font = input; preserveAspect; endGroup; nowordwrap; ] Do[ Live[ Change[ Object3D["surface"] , Opacity -> Cos[ i ] ]]; , {i , 0, 2Pi , Pi/5 }]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The rendering of the surface can be reduced to a point cloud, wireframe or flat/smooth polygons RenderMode -> PointCloud / WireFrame / FlatShaded / SmoothShaded :[font = input; preserveAspect; nowordwrap; ] Live[ Change[ Object3D["surface"] , RenderMode -> PointCloud ]]; :[font = input; preserveAspect; nowordwrap; ] Live[ Change[ Object3D["surface"] , RenderMode -> WireFrame ]]; :[font = input; preserveAspect; nowordwrap; ] Live[ Change[ Object3D["surface"] , RenderMode -> FlatShaded ]]; :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Object3D["surface"] , RenderMode -> SmoothShaded ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The object can be hidden from view Visible -> True / False / On / Off :[font = input; preserveAspect; nowordwrap; ] Live[ Change[ Object3D["surface"] , Visible -> False ]]; (* Or Visible->Off *) :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Object3D["surface"] , Visible -> True ]]; (* Or Visible->On *) :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The user can be prevented from moving the object independently . MouseMovement -> True / False / On / Off :[font = input; preserveAspect; nowordwrap; ] Live[ Change[ Object3D["surface"] , MouseMovement -> False ]]; (* or, MouseMovement -> Off *) :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Object3D["surface"] , MouseMovement -> True ]]; (* or, MouseMovement -> On *) :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The surface colors can be changed Color -> Color Color -> { foreColor(s), BackColor(s) } :[font = input; preserveAspect; nowordwrap; ] Live[ Change[ Object3D["surface"] , Color -> RGBColor[0,0,1] ]]; :[font = input; preserveAspect; endGroup; nowordwrap; ] (* Each color is applied sequentially. For surfaces with an even number of plot points this leads to a chequer pattern *) Live[ Change[ Object3D["surface"] , Color -> {{Hue[-0.2] , Hue[0]} ,{GrayLevel[1], GrayLevel[0]}} ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The position of the object can be set Location -> { x, y, z } :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Object3D["surface"] , Location -> {2,0,0} ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Objects can be scaled. A linear scale can be specified for each axis. To make a normal sized object use Scale -> 1. The invariant point is the current PointOfRotation (normally the object's origin or its centre, depending on the preferences) Scale -> +ve number Scale -> { +ve number, +ve number, +ve number } :[font = input; preserveAspect; nowordwrap; ] Live[ Change[ Object3D["surface"] , Scale -> 1.5 ]]; :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Object3D["surface"] , Scale -> { 2 , 1,8} ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The object's orientation, location and scale can be set using a matrix format. See the reference guide for more information Matrix -> "3x3OrientationMatrix" Matrix -> "4x4OrientationLocationScaleMatrix" :[font = input; preserveAspect; nowordwrap; ] Live[ Change[ Object3D["surface"] , Matrix -> { {1,0,0} , {0,1,0}, {0,0,1}} ]]; :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Object3D["surface"] , Matrix -> { {1,0,0,0} , {0,1,0,0} , {0,0,1,0} , {0,0,0,1} } ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The orientation can be set using Euler notation. The first angle is a rotation about the Z axis, the second about the new Y axis and the third about the new Z axis. See the Rotation example notebook for more details. The orientation can also be reset using Euler-> Reset Euler -> { omega, theta, psi } / Reset :[font = input; preserveAspect; endGroup; nowordwrap; ] (* Small rotation around the Z axis *) Live[ Change[ Object3D["surface"] , Euler -> {0,0, Pi/20} ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The orientation can also be set using the YawPitchRoll notation. The first angle is a rotation about the Z axis, the second about the X axis and the third about the new Y axis. Note that the Yaw is unusual because it is a negative (clockwise) rotation- this ensures that a positive yaw rotates from North (Y direction) to East (X direction). See the Rotation example notebook for more details. :[font = input; preserveAspect; nowordwrap; ] YawPitchRoll -> { yawAngle, pitchAngle, rollAngle } / Reset :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Object3D["surface"] , YawPitchRoll -> {0,Pi,0} ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] Finally, the orientation can be rotating about a given axis 'theta' radians. See the Rotation example notebook for more details. :[font = input; preserveAspect; nowordwrap; ] AxisAndAngle -> { { x, y, z } , theta } / Reset :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Object3D["surface"] , AxisAndAngle -> { {1,1,1}, Pi} ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The invariant point of rotation can be set. (This also affects the the scaling point) Note that currently, setting the point of rotation will reset the object's position and orientation. This will change in the future. PointOfRotation -> { x, y, z } PointOfRotation -> Centre / Center :[font = input; preserveAspect; nowordwrap; ] Live[ Change[ Object3D["surface"] , PointOfRotation -> {1,1,0} ]]; :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Object3D["surface"] , PointOfRotation -> Centre ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The model's bounding box can be hidden or displayed ShowBoundingBox -> True / On / False / Off :[font = input; preserveAspect; nowordwrap; ] Live[ Change[ Model3D["Default`"] , BoundingBox -> True ]]; (* or On *) :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Model3D["Default`"] , BoundingBox -> False ]]; (* or Off *) :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The model range can be explicitly set. This will rescale every vertex in the model. The preferred format is ModelRange -> { { xMin,xMax}, { yMin,yMax} , { zMin, zMax}} But the following is also accepted ModelRange -> { { xMin, yMin, zMin} , { xMax, yMax, zMax } } The linear scale along each axis should be the same when more that one object exists in the scene. :[font = input; preserveAspect; endGroup; nowordwrap; ] Live[ Change[ Model3D["Default`"] , ModelRange -> {{0,1},{0,1},{0,1}} ]]; :[font = subsubsection; inactive; preserveAspect; startGroup; Cclosed; nohscroll; ] The Camera can be attached to the model. When it is attached, all camera movements are scaled by the current model range. When the model is moved the camera will move with it - hence the rotating the parent model in MathLive will give a static scene. Parent -> Model3D["myModel`"] Parent -> None :[font = input; preserveAspect; nowordwrap; ] Live[ Change[ Camera["Camera"] , Parent -> Model3D["Default`"] ]]; :[font = input; preserveAspect; endGroup; endGroup; nowordwrap; ] Live[ Change[ Camera["Camera"] , Parent -> None ]]; :[font = section; inactive; preserveAspect; nohscroll; ] For further information, advice or suggestions please contact- :[font = text; inactive; preserveAspect; 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/ ^*)