(* ::Package:: *)

(************************************************************************)
(* This file was generated automatically by the Mathematica front end.  *)
(* It contains Initialization cells from a Notebook file, which         *)
(* typically will have the same name as this file except ending in      *)
(* ".nb" instead of ".m".                                               *)
(*                                                                      *)
(* This file is intended to be loaded into the Mathematica kernel using *)
(* the package loading commands Get or Needs.  Doing so is equivalent   *)
(* to using the Evaluate Initialization Cells menu command in the front *)
(* end.                                                                 *)
(*                                                                      *)
(* DO NOT EDIT THIS FILE.  This entire file is regenerated              *)
(* automatically each time the parent Notebook file is saved in the     *)
(* Mathematica front end.  Any changes you make to this file will be    *)
(* overwritten.                                                         *)
(************************************************************************)



<< KnotTheory`


Pog::usage = "Pog[R,r,h,v,m] represents a standard + crossing pog of radius R, height 2h, translation v, rotation matrix m, and tube radius r.";
Pog[R_,r_,h_,v_, m_] := GeometricTransformation[
{
Green, Opacity[0.3], Cylinder[{{0,0,-h},{0,0,h}},R],
Red, Opacity[1], CapForm[None], {
Tube[BSplineCurve[{{1,0,0},{0,0,-h},{-1,0,0}}], r],
Tube[BSplineCurve[{{0,1,0},{0,0,h},{0,-1,0}}], r]
}
},
AffineTransform@{v,m}
]


PogForm /: PogForm[RR_,R_,r_,h_][pd_PD] := Module[{n,vs,ms,es,i1,d1,i2,d2,tvs,dvs},
tvs={{R,0,0}, {0,R,0}, {-R,0,0},{0,-R,0}};
dvs={{R,0,-h}, {0,R,h}, {-R,0,-h},{0,-R,h}};
n=Length[pd];
es=List@@Union@@pd;
vs=RandomReal[{-RR+R,RR-R}, {n,3}];
ms=Table[Orthogonalize[RandomReal[{-1,1}, {3,3}]], {n}];
Graphics3D[{
Table[Pog[R,r,h, ms[[i]],vs[[i]]], {i,n}],
Blue,Opacity[1], CapForm[None],
Table[
{{i1,d1},{i2,d2}}=Position[pd,e];
Tube[BSplineCurve[{
vs[[i1]]+ms[[i1]].tvs[[d1]], vs[[i1]]+ms[[i1]].(tvs[[d1]]+dvs[[d1]]),
vs[[i2]]+ms[[i2]].(tvs[[d2]]+dvs[[d2]]), vs[[i2]]+ms[[i2]].tvs[[d2]]
}], r],
{e,es}
]
}, Boxed -> False]
]



