(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 9.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 157, 7] NotebookDataLength[ 14573, 367] NotebookOptionsPosition[ 14276, 353] NotebookOutlinePosition[ 14618, 368] CellTagsIndexPosition[ 14575, 365] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"Do", "[", RowBox[{ RowBox[{ RowBox[{"k", "=", "1"}], ";", RowBox[{"k", "\[LessEqual]", "nj"}]}], ",", RowBox[{"k", "++"}], ",", RowBox[{"(", RowBox[{ RowBox[{"c", "=", RowBox[{"conn", "[", RowBox[{"[", RowBox[{"conj", "[", RowBox[{"[", "k", "]"}], "]"}], "]"}], "]"}]}], ";", "\n", RowBox[{"c", "=", RowBox[{"Take", "[", RowBox[{"c", ",", "P"}], "]"}]}], ";", "\n", RowBox[{"v", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Join", "[", RowBox[{ RowBox[{"t", "[", RowBox[{"[", RowBox[{"c", "[", RowBox[{"[", "i", "]"}], "]"}], "]"}], "]"}], ",", RowBox[{"{", "1", "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "P"}], "}"}]}], "]"}]}], ";", "\n", RowBox[{"x2", "=", RowBox[{"t", "[", RowBox[{"[", RowBox[{ RowBox[{"c", "[", RowBox[{"[", "2", "]"}], "]"}], ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"y2", "=", RowBox[{"t", "[", RowBox[{"[", RowBox[{ RowBox[{"c", "[", RowBox[{"[", "2", "]"}], "]"}], ",", "2"}], "]"}], "]"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"z2", "=", RowBox[{"t", "[", RowBox[{"[", RowBox[{ RowBox[{"c", "[", RowBox[{"[", "2", "]"}], "]"}], ",", "3"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Q", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "0", ",", "0", ",", "0"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"0", ",", "1", ",", "0", ",", "0"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"0", ",", "0", ",", "1", ",", "0"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"-", "x2"}], ",", RowBox[{"-", "y2"}], ",", RowBox[{"-", "z2"}], ",", "1"}], "}"}]}], "}"}]}], ";", "\n", RowBox[{"p", "=", RowBox[{"v", ".", "Q"}]}], ";", "\[IndentingNewLine]", RowBox[{"p", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Take", "[", RowBox[{ RowBox[{"p", "[", RowBox[{"[", "i", "]"}], "]"}], ",", "3"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "P"}], "}"}]}], "]"}]}], ";", "\n", RowBox[{"T1", "=", RowBox[{"ArcTan", "[", RowBox[{ RowBox[{"p", "[", RowBox[{"[", RowBox[{"1", ",", "3"}], "]"}], "]"}], "/", RowBox[{"p", "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}]}], "]"}]}], ";", "\n", RowBox[{"U", "=", "p"}], ";", "\n", RowBox[{"T", "=", RowBox[{"RotationMatrix", "[", RowBox[{"T1", ",", RowBox[{"{", RowBox[{"1", ",", "0", ",", "0"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"p", "=", RowBox[{"U", ".", "T"}]}], ";", "\n", RowBox[{"T2", "=", RowBox[{"ArcTan", "[", RowBox[{ RowBox[{"p", "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}], "/", RowBox[{"p", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}]}], ";", "\n", RowBox[{"U", "=", "p"}], ";", "\[IndentingNewLine]", RowBox[{"T", "=", RowBox[{"RotationMatrix", "[", RowBox[{"T2", ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", "1"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"p", "=", RowBox[{"U", ".", "T"}]}], ";", "\n", RowBox[{"T3", "=", RowBox[{"ArcTan", "[", RowBox[{ RowBox[{"p", "[", RowBox[{"[", RowBox[{"3", ",", "3"}], "]"}], "]"}], "/", RowBox[{"p", "[", RowBox[{"[", RowBox[{"3", ",", "2"}], "]"}], "]"}]}], "]"}]}], ";", "\n", RowBox[{"U", "=", "p"}], ";", "\n", RowBox[{"T", "=", RowBox[{"RotationMatrix", "[", RowBox[{"T3", ",", RowBox[{"{", RowBox[{"1", ",", "0", ",", "0"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"p", "=", RowBox[{"Chop", "[", RowBox[{"U", ".", "T"}], "]"}]}], ";", "\n", RowBox[{"nk", "=", "p"}], ";", "\[IndentingNewLine]", RowBox[{"nl", "=", "p"}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"nk", "[", RowBox[{"[", RowBox[{"1", ",", "3"}], "]"}], "]"}], "=", "rpo"}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"nl", "[", RowBox[{"[", RowBox[{"1", ",", "3"}], "]"}], "]"}], "=", RowBox[{"-", "rpi"}]}], ";", "\n", RowBox[{"U", "=", "p"}], ";", "\n", RowBox[{"U1", "=", "nk"}], ";", "\[IndentingNewLine]", RowBox[{"U2", "=", "nl"}], ";", "\[IndentingNewLine]", RowBox[{"T", "=", RowBox[{"RotationMatrix", "[", RowBox[{ RowBox[{"-", "T3"}], ",", RowBox[{"{", RowBox[{"1", ",", "0", ",", "0"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"p", "=", RowBox[{"U", ".", "T"}]}], ";", "\n", RowBox[{"nk", "=", RowBox[{"U1", ".", "T"}]}], ";", "\[IndentingNewLine]", RowBox[{"nl", "=", RowBox[{"U2", ".", "T"}]}], ";", "\n", RowBox[{"U", "=", "p"}], ";", "\n", RowBox[{"U1", "=", "nk"}], ";", "\[IndentingNewLine]", RowBox[{"U2", "=", "nl"}], ";", "\[IndentingNewLine]", RowBox[{"T", "=", RowBox[{"RotationMatrix", "[", RowBox[{ RowBox[{"-", "T2"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", "1"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"p", "=", RowBox[{"U", ".", "T"}]}], ";", "\n", RowBox[{"nk", "=", RowBox[{"U1", ".", "T"}]}], ";", "\[IndentingNewLine]", RowBox[{"nl", "=", RowBox[{"U2", ".", "T"}]}], ";", "\n", RowBox[{"U", "=", "p"}], ";", "\n", RowBox[{"U1", "=", "nk"}], ";", "\[IndentingNewLine]", RowBox[{"U2", "=", "nl"}], ";", "\[IndentingNewLine]", RowBox[{"T", "=", RowBox[{"RotationMatrix", "[", RowBox[{ RowBox[{"-", "T1"}], ",", RowBox[{"{", RowBox[{"1", ",", "0", ",", "0"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"p", "=", RowBox[{"U", ".", "T"}]}], ";", "\n", RowBox[{"nk", "=", RowBox[{"U1", ".", "T"}]}], ";", "\[IndentingNewLine]", RowBox[{"nl", "=", RowBox[{"U2", ".", "T"}]}], ";", "\n", RowBox[{"Clear", "[", RowBox[{"v", ",", "v1", ",", "v2"}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"v", " ", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Join", "[", RowBox[{ RowBox[{"p", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"{", "1", "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "P"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"v1", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Join", "[", RowBox[{ RowBox[{"nk", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"{", "1", "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "P"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"v2", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Join", "[", RowBox[{ RowBox[{"nl", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"{", "1", "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "P"}], "}"}]}], "]"}]}], ";", "\n", RowBox[{"Q", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "0", ",", "0", ",", "0"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"0", ",", "1", ",", "0", ",", "0"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"0", ",", "0", ",", "1", ",", "0"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"x2", ",", "y2", ",", "z2", ",", "1"}], "}"}]}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"p", "=", RowBox[{"v", ".", "Q"}]}], ";", "\[IndentingNewLine]", RowBox[{"nk", "=", RowBox[{"v1", ".", "Q"}]}], ";", "\[IndentingNewLine]", RowBox[{"nl", "=", RowBox[{"v2", ".", "Q"}]}], ";", "\[IndentingNewLine]", RowBox[{"p", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Take", "[", RowBox[{ RowBox[{"p", "[", RowBox[{"[", "i", "]"}], "]"}], ",", "3"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "P"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"nk", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Take", "[", RowBox[{ RowBox[{"nk", "[", RowBox[{"[", "i", "]"}], "]"}], ",", "3"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "P"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"nl", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Take", "[", RowBox[{ RowBox[{"nl", "[", RowBox[{"[", "i", "]"}], "]"}], ",", "3"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "P"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"tpo", "[", RowBox[{"[", "k", "]"}], "]"}], "=", "nk"}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"tpu", "[", RowBox[{"[", "k", "]"}], "]"}], "=", "nl"}]}], ")"}]}], "]"}], ";"}], "\[IndentingNewLine]"}]], "Input", CellGroupingRules->{GroupTogetherGrouping, 10000.}, CellChangeTimes->{{3.5717611834272623`*^9, 3.571761287767046*^9}, { 3.571761989144278*^9, 3.5717619949942884`*^9}, {3.5717626601482563`*^9, 3.5717627281175756`*^9}, 3.5717640513743*^9, 3.5717643152643633`*^9, { 3.571767210754249*^9, 3.5717672165886593`*^9}, {3.5721945360946617`*^9, 3.5721945430210743`*^9}, {3.5721946674468927`*^9, 3.5721946710192986`*^9}, {3.5725377974045963`*^9, 3.5725378035510073`*^9}, {3.5725821589210215`*^9, 3.572582165613433*^9}, { 3.5725823497249565`*^9, 3.5725823568073688`*^9}, {3.5725824653055596`*^9, 3.5725824738231745`*^9}, {3.5725826816467395`*^9, 3.572582688744752*^9}, { 3.5725874074450407`*^9, 3.57258741299865*^9}, {3.572587506770415*^9, 3.5725875134316263`*^9}, {3.5725877054055634`*^9, 3.5725877116455746`*^9}, {3.5726014967532883`*^9, 3.5726015309485483`*^9}, {3.572604709594531*^9, 3.572604713775338*^9}, { 3.5726068528822956`*^9, 3.5726068582799053`*^9}, {3.572606893629567*^9, 3.5726068992767773`*^9}, 3.5726069733145075`*^9, {3.572607033686613*^9, 3.572607038117021*^9}, {3.572607723738225*^9, 3.5726077623014927`*^9}, { 3.572607825356804*^9, 3.572607831160014*^9}, {3.572608222907902*^9, 3.5726082231887026`*^9}, {3.5726085858893394`*^9, 3.572608589227745*^9}, { 3.572608663093875*^9, 3.572608669708287*^9}, {3.5726089657032065`*^9, 3.572608990944051*^9}, {3.5726090674621854`*^9, 3.572609106727454*^9}, { 3.572609315596221*^9, 3.572609328029443*^9}, {3.572613056738207*^9, 3.572613057986209*^9}, {3.5726132251717024`*^9, 3.572613232784516*^9}, { 3.5726213872551675`*^9, 3.5726213881755695`*^9}, {3.5726268939768395`*^9, 3.572626916331679*^9}, {3.57262844270076*^9, 3.572628450609974*^9}, { 3.572666736959175*^9, 3.5726667470367928`*^9}, {3.5726673703202877`*^9, 3.572667394952731*^9}, 3.57270668214774*^9, {3.5727071495177608`*^9, 3.5727071819658175`*^9}, {3.5727072712759743`*^9, 3.5727073128032475`*^9}, {3.5727073679493446`*^9, 3.5727073724733524`*^9}, {3.5727076759406853`*^9, 3.5727076771262875`*^9}, {3.572707904044286*^9, 3.572707908615094*^9}, { 3.5727080701689777`*^9, 3.572708083429001*^9}, {3.5727082522212973`*^9, 3.5727082670725236`*^9}, {3.572708559838238*^9, 3.5727085620066414`*^9}, { 3.572709188612942*^9, 3.5727092006873636`*^9}, {3.572709311915559*^9, 3.5727093163615665`*^9}, {3.5727093855632877`*^9, 3.57270938659289*^9}, { 3.572709508865905*^9, 3.5727095702676125`*^9}, 3.5727097033826466`*^9, { 3.5727105361121087`*^9, 3.57271053676731*^9}, 3.5727147586291027`*^9, { 3.572715941017579*^9, 3.5727159460095882`*^9}, 3.5727757213782988`*^9, { 3.5727776626613083`*^9, 3.5727776631449094`*^9}, {3.5727778755392823`*^9, 3.5727778968333197`*^9}, {3.5727795526402283`*^9, 3.5727795586774387`*^9}, {3.572793717442012*^9, 3.572793746738863*^9}, { 3.5727938588562603`*^9, 3.5727938850175056`*^9}, {3.572793916217561*^9, 3.5727939489152184`*^9}, {3.572793980801674*^9, 3.5727940593166122`*^9}}] }, WindowSize->{707, 880}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, FrontEndVersion->"9.0 for Microsoft Windows (64-bit) (January 25, 2013)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[557, 20, 13715, 331, 1332, "Input", CellGroupingRules->{GroupTogetherGrouping, 10000.}] } ] *) (* End of internal cache information *)