blob: b59e07f26936f6705f6ec19e536a6a707c73fcd9 [file] [log] [blame]
Austin Schuh405fa6c2015-09-06 18:13:55 -07001(*******************************************************************
2This file was generated automatically by the Mathematica front end.
3It contains Initialization cells from a Notebook file, which
4typically will have the same name as this file except ending in
5".nb" instead of ".m".
6
7This file is intended to be loaded into the Mathematica kernel using
8the package loading commands Get or Needs. Doing so is equivalent
9to using the Evaluate Initialization Cells menu command in the front
10end.
11
12DO NOT EDIT THIS FILE. This entire file is regenerated
13automatically each time the parent Notebook file is saved in the
14Mathematica front end. Any changes you make to this file will be
15overwritten.
16***********************************************************************)
17
18Off[General::spell1];Off[General::spell]
19
20
21(* Russell Towle's codes to create projections (zonotopes) of
22hypercubes. *)
23
24cross[ {ax_, ay_, az_}, {bx_, by_, bz_} ] := (*cross product*)
25 {ay bz - az by, az bx - ax bz, ax by - ay bx}
26
27mag[v_]:= Sqrt[Plus@@(v^2)] (*magnitude of a vector*)
28
29unit[v_]:= v/Sqrt[v.v] (*make unit vector*)
30
31tolerance=0.000001;
32collinear[ v1_, v2_ ] := (*test for collinearity*)
33 Apply[And, Map[Abs[#]<tolerance&, cross[v1,v2]]]
34
35setStar[vlist_] := (*discard collinear vectors*)
36 Module[{selected={}},
37 Scan[Function[v, If[v!={0,0,0} &&
38 Select[selected,
39 collinear[v,#]&]=={},
40 AppendTo[selected,v]] ],
41 vlist];
42
43 Print[Length[selected]," zonal directions."];
44 gStar=selected] (*gStar is global, list of non-collinear vectors*)
45
46
47
48(* Here I set to a directory where I store
49the packages I need *)
50
51SetDirectory["~/Math"]
52
53cddml=Install["~/Math/cddmathlink"]
54
55Needs["ExtendGraphics`View3D`"];
56
57<<UnfoldPolytope.m
58
59<<Combinatorica5.m
60
61<<PolytopeSkeleton.m
62
63<<IOPolyhedra.m
64
65(*the vectors which determine an n-merous polar zonohedron*)
66(*3<=n, 0<=pitch<=90 degrees*)
67
68vectors[n_Integer,pitch_]:=
69Table[N[{Cos[Degree pitch] Cos[2Pi i/n],
70 Cos[Degree pitch] Sin[2Pi i/n],
71 -Sin[Degree pitch]},15],
72 {i,n}] (* modified by KF, precision 15 added *)
73
74(*the pitch at which a polar zonohedron is
75an isometric shadow of an n-cube*)
76
77N[1/Degree * ArcTan[(1/2)^(1/2)],15];
78
79
80(*Here, we obtain the vectors for an isometric projection of
81a d-cube into cyclic symmetry*)
82
83dim=8;
84gen=Zonotope[vectors[dim, N[ 1/Degree * ArcTan[(1/2)^(1/2)],15 ] ] ];
85genc = Chop[gen,10^(-12)];
86
87extlist=Map[Prepend[#,1]&,genc];
88{n,d}=Dimensions[extlist]