(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.1' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 10212, 268]*) (*NotebookOutlinePosition[ 11031, 297]*) (* CellTagsIndexPosition[ 10987, 293]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["LiveGraphics3D", "Title", TextAlignment->Center, TextJustification->0], Cell[CellGroupData[{ Cell["Introduction", "Section"], Cell[TextData[{ "The LiveGraphics3D applet has been in use for many years. Martin Kraus \ wrote the applet originally to allow ", StyleBox["Mathematica", FontSlant->"Italic"], " graphics to be displayed and rotated (using the mouse) from a web page. \ Later, he added a link to J/Link to let people use its functionality directly \ from ", StyleBox["Mathematica", FontSlant->"Italic"], ". This example shows you how to use the SuperWidgetLiveGraphics3D super \ widget to embed this applet in a more general GUI. You will get a diagnostic \ if you attempt to run this example without first installing the \ LiveGraphics3D applet." }], "Text"], Cell[CellGroupData[{ Cell["Code", "Subsection"], Cell[BoxData[ RowBox[{ RowBox[{"Needs", "[", "\"\\"", "]"}], ";"}]], "Input", CellLabel->"In[42]:="], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"lg", "=", RowBox[{"Graphics3D", "[", RowBox[{ RowBox[{"Plot3D", "[", RowBox[{ RowBox[{"Sin", "[", RowBox[{"x", " ", "y"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "4"}], ",", "4"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "4"}], ",", "4"}], "}"}], ",", RowBox[{"DisplayFunction", "\[Rule]", "Identity"}]}], "]"}], ",", RowBox[{"ImageSize", "\[Rule]", RowBox[{"{", RowBox[{"1024", ",", "800"}], "}"}]}], ",", RowBox[{"ViewPoint", "\[Rule]", RowBox[{"{", RowBox[{"1", ",", "1", ",", "1"}], "}"}]}], ",", RowBox[{"ViewVertical", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "0", ",", "1"}], "}"}]}]}], "]"}]}], ";"}], "\[IndentingNewLine]"}], "\n", RowBox[{ RowBox[{"vp", "=", RowBox[{"ViewPoint", "/.", RowBox[{"Options", "[", RowBox[{"Plot3D", ",", "ViewPoint"}], "]"}]}]}], ";"}], "\n", RowBox[{ RowBox[{"\[Theta]", "=", "0.0"}], ";"}], "\n", RowBox[{ RowBox[{ RowBox[{ RowBox[{"rotate", "[", "v_", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"applet", "=", RowBox[{"LiveGraphics3DApplet", "[", "lg", "]"}]}], ",", "vp1"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"vp1", "=", RowBox[{"Dot", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Cos", "[", "\[Theta]", "]"}], ",", RowBox[{"Sin", "[", "\[Theta]", "]"}], ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", RowBox[{"Sin", "[", "\[Theta]", "]"}]}], ",", RowBox[{"Cos", "[", "\[Theta]", "]"}], ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", "1"}], "}"}]}], "}"}], ",", "vp"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"applet", "@", RowBox[{"rotateToViewPointAndViewVertical", "[", RowBox[{"Sequence", "@@", RowBox[{"Join", "[", RowBox[{"vp1", ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", "1"}], "}"}]}], "]"}]}], "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\n"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"zoom\[Breve]out", "[", "v_", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"applet", "=", RowBox[{"LiveGraphics3DApplet", "[", "lg", "]"}]}], ",", "mag"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"mag", "=", RowBox[{"applet", "@", RowBox[{"getMagnification", "[", "]"}]}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"applet", "@", RowBox[{"setMagnification", "[", RowBox[{"mag", "*", "0.7"}], "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\n"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"zoom\[Breve]in", "[", "v_", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"applet", "=", RowBox[{"LiveGraphics3DApplet", "[", "lg", "]"}]}], ",", "mag"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"mag", "=", RowBox[{"applet", "@", RowBox[{"getMagnification", "[", "]"}]}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"applet", "@", RowBox[{"setMagnification", "[", RowBox[{"mag", "/", "0.7"}], "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\n"}], "\[IndentingNewLine]", RowBox[{"SuperGUIRunModal", "[", RowBox[{"SuperWidgetFrame", "[", RowBox[{"Null", ",", RowBox[{"{", RowBox[{ RowBox[{"SuperWidgetLiveGraphics3D", "[", RowBox[{"lg", ",", RowBox[{"Pixel\[Breve]Width", "\[Rule]", "800"}], ",", RowBox[{"Pixel\[Breve]Height", "\[Rule]", "600"}]}], "]"}], ",", SubscriptBox["\[Paragraph]", "10"], ",", "\[IndentingNewLine]", RowBox[{"SuperWidgetHorizontalSlider", "[", RowBox[{"\[Theta]", ",", "0", ",", RowBox[{"2", "\[Pi]"}], ",", RowBox[{"ChangeFunction", "\[Rule]", "rotate"}]}], "]"}], ",", SubscriptBox["\[Paragraph]", "10"], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ SubscriptBox["\[Paragraph]", "0"], ",", RowBox[{"SuperWidgetButton", "[", RowBox[{"Null", ",", "\"\\"", ",", "1"}], "]"}], ",", SubscriptBox["\[Paragraph]", "0"]}], "}"}], ",", SubscriptBox["\[Paragraph]", "10"]}], "}"}], ",", RowBox[{"Tool\[Breve]Bar", "->", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"SuperWidgetButton", "[", RowBox[{ "Null", ",", "\"\\"", ",", "zoom\[Breve]out"}], "]"}], ",", RowBox[{"SuperWidgetButton", "[", RowBox[{ "Null", ",", "\"\\"", ",", "zoom\[Breve]in"}], "]"}]}], "\[IndentingNewLine]", "}"}]}]}], "\[IndentingNewLine]", "]"}], "\[IndentingNewLine]", "]"}]}], "Input",\ CellLabel->"In[65]:="], Cell[BoxData["1"], "Output", CellLabel->"Out[71]="] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Comments", "Subsection"], Cell["\<\ The plot can be rotated by moving the slider. To be more precise, it is the \ viewpoint that is being moved in a circle about the plot. It can also be \ manipulated directly in the traditional LiveGraphics3D way. Note also, the \ zoom buttons on the toolbar.\ \>", "Text"] }, Open ]] }, Open ]] }, Open ]] }, FrontEndVersion->"5.1 for Microsoft Windows", ScreenRectangle->{{0, 1280}, {0, 967}}, AutoGeneratedPackage->Automatic, WindowToolbars->"EditBar", WindowSize->{994, 673}, WindowMargins->{{Automatic, 96}, {Automatic, 63}}, Visible->True, ShowSelection->True, ShowCellLabel->False, Magnification->1, StyleDefinitions -> "HelpBrowser.nb" ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1776, 53, 80, 2, 105, "Title"], Cell[CellGroupData[{ Cell[1881, 59, 31, 0, 65, "Section"], Cell[1915, 61, 659, 14, 59, "Text"], Cell[CellGroupData[{ Cell[2599, 79, 26, 0, 39, "Subsection"], Cell[2628, 81, 141, 4, 29, "Input"], Cell[CellGroupData[{ Cell[2794, 89, 6957, 158, 589, "Input"], Cell[9754, 249, 53, 1, 27, "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[9856, 256, 30, 0, 39, "Subsection"], Cell[9889, 258, 283, 5, 42, "Text"] }, Open ]] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)