(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 19479, 622] NotebookOptionsPosition[ 18364, 578] NotebookOutlinePosition[ 18858, 598] CellTagsIndexPosition[ 18815, 595] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[TextData[{ "17-Nov-2007 revised for ", StyleBox["Mathematica", FontSlant->"Italic"], " Version 6" }], "Text", CellChangeTimes->{{3.4044901110857677`*^9, 3.404490123401141*^9}}], Cell[CellGroupData[{ Cell["\<\ mQhull: delaunayTriangulation Example\ \>", "Title", CellChangeTimes->{3.4044901031579247`*^9}, FontSize->24], Cell[CellGroupData[{ Cell["\<\ \[Copyright]2006 (click to the right for licensing information and details)\ \>", "Subsubsection"], Cell[TextData[{ "\[Copyright]2006 California Institute of Technology.\nAll Rights Reserved.\n\ \n", StyleBox["This library is free software; you can redistribute it and/or \ modify it under the terms of the GNU Lesser Public License as published by \ the Free Software Foundation; either version 2.1 of the License, or any later \ version.\n\nThis library is distributed in the hope that it will be useful, \ but WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF \ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and \ documentation provided hereunder is on an \"as is\" basis, and the \ California Institute of Technology has no obligations to provide maintenance, \ support, updates, enhancements or modifications. In no event shall the \ California Institute of Technology be liable to any party for direct, \ indirect, special, incidental or consequential damages, including lost \ profits, arising out of the use of this software and its documentation, even \ if the California Institute of Technology have been advised of the \ possibility of such damage. See the GNU Lesser General Public License for \ more details.\n\nYou should have received a copy of the GNU Lesser General \ Public License along with this library; if not, write to the Free Software \ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.\n\n \ The original code contained here was initially developed by:\n\n \tBruce E. \ Shapiro\n \tBiological Network Modeling Center\n \tDivision of Biology, Mail \ Code 139-74\n \tCalifornia Institute of Technology\n \tPasadena, CA, 91125, \ USA\n \tbshapiro at caltech dot edu", FontSize->12] }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["delaunay Triangulation", "Section"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"points", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"6.8", ",", "7.4"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "3."}], ",", "9.6"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "9.3"}], ",", RowBox[{"-", "6.9"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.4"}], ",", RowBox[{"-", "7.3"}]}], "}"}], ",", RowBox[{"{", RowBox[{"10.9", ",", RowBox[{"-", "7.1"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "10.6"}], ",", RowBox[{"-", "17.5"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1."}], ",", RowBox[{"-", "17.5"}]}], "}"}], ",", RowBox[{"{", RowBox[{"10.2", ",", RowBox[{"-", "17.5"}]}], "}"}]}], "}"}]}]], "Input"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"6.8`", ",", "7.4`"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "3.`"}], ",", "9.6`"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "9.3`"}], ",", RowBox[{"-", "6.9`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.4`"}], ",", RowBox[{"-", "7.3`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"10.9`", ",", RowBox[{"-", "7.1`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "10.6`"}], ",", RowBox[{"-", "17.5`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1.`"}], ",", RowBox[{"-", "17.5`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"10.2`", ",", RowBox[{"-", "17.5`"}]}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.404490010366981*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"dt", "=", RowBox[{"delaunayTriangulation", "[", RowBox[{"points", ",", RowBox[{"delaunayFormat", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"edgeCoordinates", "->", " ", "True"}], ",", RowBox[{"regions", "\[Rule]", " ", "True"}], ",", RowBox[{"regionCoordinates", "\[Rule]", " ", "True"}]}], "}"}]}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"edges", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "4"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "5"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{"2", ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"2", ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{"3", ",", "4"}], "}"}], ",", RowBox[{"{", RowBox[{"4", ",", "5"}], "}"}], ",", RowBox[{"{", RowBox[{"4", ",", "7"}], "}"}], ",", RowBox[{"{", RowBox[{"4", ",", "8"}], "}"}], ",", RowBox[{"{", RowBox[{"5", ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{"5", ",", "8"}], "}"}], ",", RowBox[{"{", RowBox[{"5", ",", "9"}], "}"}], ",", RowBox[{"{", RowBox[{"6", ",", "9"}], "}"}], ",", RowBox[{"{", RowBox[{"7", ",", "8"}], "}"}], ",", RowBox[{"{", RowBox[{"8", ",", "9"}], "}"}]}], "}"}]}], ",", RowBox[{"regions", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"2", ",", "1", ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "2", ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "5", ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{"5", ",", "9", ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{"4", ",", "5", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"4", ",", "1", ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"5", ",", "8", ",", "9"}], "}"}], ",", RowBox[{"{", RowBox[{"8", ",", "4", ",", "7"}], "}"}], ",", RowBox[{"{", RowBox[{"4", ",", "8", ",", "5"}], "}"}]}], "}"}]}], ",", RowBox[{"edgeCoordinates", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"6.8`", ",", "7.4`"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "3.`"}], ",", "9.6`"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "9.3`"}], ",", RowBox[{"-", "6.9`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.4`"}], ",", RowBox[{"-", "7.3`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"10.9`", ",", RowBox[{"-", "7.1`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"6.8`", ",", "7.4`"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "3.`"}], ",", "9.6`"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"6.8`", ",", "7.4`"}], "}"}], ",", RowBox[{"{", RowBox[{"10.9`", ",", RowBox[{"-", "7.1`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "3.`"}], ",", "9.6`"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "9.3`"}], ",", RowBox[{"-", "6.9`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "9.3`"}], ",", RowBox[{"-", "6.9`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.4`"}], ",", RowBox[{"-", "7.3`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "9.3`"}], ",", RowBox[{"-", "6.9`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "10.6`"}], ",", RowBox[{"-", "17.5`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "9.3`"}], ",", RowBox[{"-", "6.9`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1.`"}], ",", RowBox[{"-", "17.5`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "0.4`"}], ",", RowBox[{"-", "7.3`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"10.9`", ",", RowBox[{"-", "7.1`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "0.4`"}], ",", RowBox[{"-", "7.3`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1.`"}], ",", RowBox[{"-", "17.5`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "0.4`"}], ",", RowBox[{"-", "7.3`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"10.2`", ",", RowBox[{"-", "17.5`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"10.9`", ",", RowBox[{"-", "7.1`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"10.2`", ",", RowBox[{"-", "17.5`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "10.6`"}], ",", RowBox[{"-", "17.5`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1.`"}], ",", RowBox[{"-", "17.5`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1.`"}], ",", RowBox[{"-", "17.5`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"10.2`", ",", RowBox[{"-", "17.5`"}]}], "}"}]}], "}"}]}], "}"}]}], ",", RowBox[{"regionCoordinates", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"6.8`", ",", "7.4`"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"10.9`", ",", RowBox[{"-", "7.1`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"6.8`", ",", "7.4`"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "3.`"}], ",", "9.6`"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.4`"}], ",", RowBox[{"-", "7.3`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"10.9`", ",", RowBox[{"-", "7.1`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "0.4`"}], ",", RowBox[{"-", "7.3`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"10.2`", ",", RowBox[{"-", "17.5`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"10.9`", ",", RowBox[{"-", "7.1`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "9.3`"}], ",", RowBox[{"-", "6.9`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.4`"}], ",", RowBox[{"-", "7.3`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "9.3`"}], ",", RowBox[{"-", "6.9`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "3.`"}], ",", "9.6`"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "0.4`"}], ",", RowBox[{"-", "7.3`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1.`"}], ",", RowBox[{"-", "17.5`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"10.2`", ",", RowBox[{"-", "17.5`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1.`"}], ",", RowBox[{"-", "17.5`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "9.3`"}], ",", RowBox[{"-", "6.9`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "10.6`"}], ",", RowBox[{"-", "17.5`"}]}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "9.3`"}], ",", RowBox[{"-", "6.9`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1.`"}], ",", RowBox[{"-", "17.5`"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.4`"}], ",", RowBox[{"-", "7.3`"}]}], "}"}]}], "}"}]}], "}"}]}], ",", RowBox[{"statistics", "\[Rule]", RowBox[{"{", RowBox[{ "11.48742936392689`", ",", "10.679419459877021`", ",", "2.560791288223172`"}], "}"}]}]}], "}"}]], "Output", CellChangeTimes->{3.404490013696492*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"pts", "=", RowBox[{"ListPlot", "[", RowBox[{"points", ",", " ", RowBox[{"PlotStyle", "\[Rule]", " ", RowBox[{"{", RowBox[{ RowBox[{"Hue", "[", ".65", "]"}], ",", RowBox[{"PointSize", "[", ".05", "]"}]}], "}"}]}], ",", RowBox[{"Axes", "\[Rule]", " ", "True"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", " ", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "15"}], ",", " ", "15"}], "}"}], ",", " ", RowBox[{"{", RowBox[{ RowBox[{"-", "20"}], ",", "12"}], "}"}]}], "}"}]}], ",", " ", RowBox[{"AspectRatio", "\[Rule]", " ", RowBox[{"32", "/", "30"}]}]}], "]"}]}]], "Input", CellChangeTimes->{{3.4044900177306004`*^9, 3.404490065050427*^9}}], Cell[BoxData[ GraphicsBox[ {Hue[0.65], PointSize[0.05], PointBox[{{0., 0.}, {6.8, 7.4}, {-3., 9.6}, {-9.3, -6.9}, {-0.4, -7.3}, { 10.9, -7.1}, {-10.6, -17.5}, {-1., -17.5}, {10.2, -17.5}}]}, AspectRatio->NCache[ Rational[16, 15], 1.0666666666666667`], Axes->True, PlotRange->{{-15, 15}, {-20, 12}}, PlotRangeClipping->True]], "Output", CellChangeTimes->{{3.404490018324314*^9, 3.404490065471799*^9}}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"dtplot", "=", RowBox[{"Show", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Graphics", "/@", RowBox[{"Line", "/@", RowBox[{"(", RowBox[{"edgeCoordinates", "/.", "dt"}], ")"}]}]}], ",", "pts"}], "}"}], ",", " ", RowBox[{"Axes", "\[Rule]", "True"}], ",", " ", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", " ", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "15"}], ",", " ", "15"}], "}"}], ",", " ", RowBox[{"{", RowBox[{ RowBox[{"-", "20"}], ",", "12"}], "}"}]}], "}"}]}], ",", " ", RowBox[{"AspectRatio", "\[Rule]", " ", RowBox[{"32", "/", "30"}]}]}], "]"}]}]], "Input", CellChangeTimes->{ 3.404490021495099*^9, {3.404490076082349*^9, 3.4044900866188707`*^9}}], Cell[BoxData[ GraphicsBox[{LineBox[{{0, 0}, {6.8, 7.4}}], LineBox[{{0, 0}, {-3., 9.6}}], LineBox[{{0, 0}, {-9.3, -6.9}}], LineBox[{{0, 0}, {-0.4, -7.3}}], LineBox[{{0, 0}, {10.9, -7.1}}], LineBox[{{6.8, 7.4}, {-3., 9.6}}], LineBox[{{6.8, 7.4}, {10.9, -7.1}}], LineBox[{{-3., 9.6}, {-9.3, -6.9}}], LineBox[{{-9.3, -6.9}, {-0.4, -7.3}}], LineBox[{{-9.3, -6.9}, {-10.6, -17.5}}], LineBox[{{-9.3, -6.9}, {-1., -17.5}}], LineBox[{{-0.4, -7.3}, {10.9, -7.1}}], LineBox[{{-0.4, -7.3}, {-1., -17.5}}], LineBox[{{-0.4, -7.3}, {10.2, -17.5}}], LineBox[{{10.9, -7.1}, {10.2, -17.5}}], LineBox[{{-10.6, -17.5}, {-1., -17.5}}], LineBox[{{-1., -17.5}, {10.2, -17.5}}], {Hue[0.65], PointSize[0.05], PointBox[{{0., 0.}, {6.8, 7.4}, {-3., 9.6}, {-9.3, -6.9}, {-0.4, -7.3}, { 10.9, -7.1}, {-10.6, -17.5}, {-1., -17.5}, {10.2, -17.5}}]}}, AspectRatio->NCache[ Rational[16, 15], 1.0666666666666667`], Axes->True, PlotRange->{{-15, 15}, {-20, 12}}]], "Output", CellChangeTimes->{ 3.4044900227784557`*^9, {3.40449007720026*^9, 3.404490087035674*^9}}] }, Open ]] }, Open ]] }, Open ]] }, WindowSize->{834, 748}, WindowMargins->{{Automatic, 291}, {Automatic, 80}}, DockedCells->(FrontEndExecute[{ FrontEnd`NotebookApply[ FrontEnd`InputNotebook[], #, Placeholder]}]& ), CellLabelAutoDelete->True, Magnification->1., FrontEndVersion->"6.0 for Mac OS X x86 (32-bit) (June 19, 2007)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[568, 21, 187, 6, 26, "Text"], Cell[CellGroupData[{ Cell[780, 31, 121, 5, 99, "Title"], Cell[CellGroupData[{ Cell[926, 40, 108, 2, 25, "Subsubsection"], Cell[1037, 44, 1679, 25, 529, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[2753, 74, 41, 0, 37, "Section"], Cell[CellGroupData[{ Cell[2819, 78, 908, 32, 43, "Input"], Cell[3730, 112, 909, 32, 43, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[4676, 149, 395, 10, 43, "Input"], Cell[5074, 161, 10027, 321, 223, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[15138, 487, 791, 21, 43, "Input"], Cell[15932, 510, 424, 10, 390, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[16393, 525, 824, 24, 43, "Input"], Cell[17220, 551, 1104, 22, 390, "Output"] }, Open ]] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)