omdl  v0.6.1
OpenSCAD Mechanical Design Library
dipyramids.scad
Go to the documentation of this file.
1 //! Table of polyhedra data group: \c dipyramids
2 /***************************************************************************//**
3  \file dipyramids.scad
4  \author Roy Allen Sutton
5  \date 2017
6 
7  \copyright
8 
9  This file is part of [omdl] (https://github.com/royasutton/omdl),
10  an OpenSCAD mechanical design library.
11 
12  The \em omdl is free software; you can redistribute it and/or modify
13  it under the terms of the [GNU Lesser General Public License]
14  (http://www.gnu.org/licenses/lgpl.html) as published by the Free
15  Software Foundation; either version 2.1 of the License, or (at
16  your option) any later version.
17 
18  The \em omdl is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  Lesser General Public License for more details.
22 
23  You should have received a copy of the GNU Lesser General Public
24  License along with the \em omdl; if not, write to the Free Software
25  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26  02110-1301, USA; or see <http://www.gnu.org/licenses/>.
27 
28  \details
29 
30  This [omdl] formatted data table has been assembled using a script
31  that converts the polyhedra data obtained from [Anthony Thyssen]'s
32  [Studies into Polyhedra]. The vertices are tabulated in both their
33  original Cartesian as well as their converted spherical coordinate
34  form, which is convenient when scaling. The data originates from
35  one of three sources:
36 
37  \li [Exact Mathematics] as presented by [Anthony Thyssen],
38  \li the [Polyhedron Database] maintained by [Netlib], and
39  \li an [Encyclopedia of Polyhedra] by [George W. Hart].
40 
41  \note Include this library file using the \b include statement.
42 
43  [omdl]: https://github.com/royasutton/omdl
44 
45  [Anthony Thyssen]: http://www.ict.griffith.edu.au/anthony/anthony.html
46  [Studies into Polyhedra]: http://www.ict.griffith.edu.au/anthony/graphics/polyhedra
47  [Exact Mathematics]: http://www.ict.griffith.edu.au/anthony/graphics/polyhedra/maths.shtml
48 
49  [George W. Hart]: http://www.georgehart.com
50  [Encyclopedia of Polyhedra]: http://www.georgehart.com/virtual-polyhedra/vp.html
51 
52  [Netlib]: http://www.netlib.org
53  [Polyhedron Database]: http://www.netlib.org/polyhedra
54 
55  \ingroup database_polyhedra
56 *******************************************************************************/
57 
58 //----------------------------------------------------------------------------//
59 /***************************************************************************//**
60  \addtogroup database_polyhedra
61  @{
62  <br>
63  ### Group: dipyramids ###
64 
65  \amu_define caption (dipyramids)
66  \amu_make png_files (append=db_dim extension=png)
67  \amu_make stl_files (append=db_dim extension=stl)
68 
69  \amu_shell file_cnt ("echo ${png_files} | wc -w")
70  \amu_shell cell_num ("seq -f '(%g)' -s '^' ${file_cnt}")
71 
72  \amu_shell html_cell_titles
73  (
74  "echo ${stl_files} | grep -Po 'db_dim_\K[^.]*' | tr '\n' '^'"
75  )
76 
77  \htmlonly
78  \amu_image_table
79  (
80  type=html columns=4 image_width="200" cell_files="${png_files}"
81  table_caption="${caption}" cell_captions="${cell_num}"
82  cell_titles="${html_cell_titles}" cell_urls="${stl_files}"
83  )
84  \endhtmlonly
85 
86  \amu_define caption (dipyramids)
87  \amu_make eps_files (append=db_dim extension=png2eps)
88 
89  \latexonly
90  \amu_image_table
91  (
92  type=latex columns=4 image_width="1.25in" cell_files="${eps_files}"
93  table_caption="${caption}" cell_captions="${cell_num}"
94  )
95  \endlatexonly
96 
97  \amu_shell data
98  (
99  "grep -Po 'ECHO: \"\K[^\"]*' build/csg/dipyramids_db_autostat.log" --rmnl
100  )
101  \amu_shell columns ("echo '${data}' | awk -F '^' 'NR==1 {print NF;exit}'")
102  \amu_shell heading ("echo '${data}' | awk -F '^' 'NR==1 {print;exit}'")
103  \amu_shell texts ("echo '${data}' | awk -F '^' 'NR>1 {print}'")
104 
105  \amu_table
106  (
107  columns=${columns} column_headings="${heading}" cell_texts="${texts}"
108  )
109 *******************************************************************************/
110 //----------------------------------------------------------------------------//
111 
112 //! <matrix-2x9> \c dipyramids polyhedra data table columns definition.
113 //! \hideinitializer
115 [
116  ["id", "identifier"],
117  ["n", "name"],
118  ["o", "other name"],
119  ["g", "group"],
120  ["d", "data source"],
121  ["c", "cartesian vertices"],
122  ["s", "spherical vertices"],
123  ["f", "faces"],
124  ["e", "edges"]
125 ];
126 
127 //! <matrix-9xR> \c dipyramids polyhedra data table rows.
128 //! \hideinitializer
130 [
131  [
132  "decagonal_bi_pyramid",
133  "Decagonal Bi-Pyramid",
134  empty_str,
135  "dipyramids",
136  "George W. Hart, 1997. george@li.net",
137  [
138  [ 0.09592986243, 0.00000000000, 0.31043557716],
139  [-0.10486056224, 0.00000000000, 0.30753382347],
140  [-0.00000000000, -1.00000000000, -0.00000000000],
141  [ 0.26007835274, 0.00000000000, 0.19476148707],
142  [-0.00000000000, 1.00000000000, -0.00000000000],
143  [-0.26559780113, 0.00000000000, 0.18716458288],
144  [ 0.32488563406, 0.00000000000, 0.00469514267],
145  [-0.32488563406, -0.00000000000, -0.00469514267],
146  [ 0.26559780113, -0.00000000000, -0.18716458288],
147  [-0.26007835274, -0.00000000000, -0.19476148707],
148  [ 0.10486056224, -0.00000000000, -0.30753382347],
149  [-0.09592986243, -0.00000000000, -0.31043557716]
150  ],
151  [
152  [0.32491966095, 0.00000000000, 17.17203674418],
153  [0.32491966714, 179.99999999999, 18.82796235856],
154  [1.00000000000, -89.99999999999, 89.99999999999],
155  [0.32491966147, 0.00000000000, 53.17203948142],
156  [1.00000000000, 89.99999999999, 89.99999999999],
157  [0.32491964091, 179.99999999999, 54.82796225358],
158  [0.32491955863, 0.00000000000, 89.17203746329],
159  [0.32491955863, -179.99999999999, 90.82796253670],
160  [0.32491964091, -0.00000000000, 125.17203774641],
161  [0.32491966147, -179.99999999999, 126.82796051856],
162  [0.32491966714, -0.00000000000, 161.17203764143],
163  [0.32491966095, -179.99999999999, 162.82796325581]
164  ],
165  [
166  [1,0,2],
167  [0,3,2],
168  [1,4,0],
169  [2,5,1],
170  [4,3,0],
171  [6,2,3],
172  [5,4,1],
173  [7,5,2],
174  [4,6,3],
175  [6,8,2],
176  [5,7,4],
177  [2,9,7],
178  [8,6,4],
179  [10,2,8],
180  [9,4,7],
181  [11,9,2],
182  [4,10,8],
183  [10,11,2],
184  [9,11,4],
185  [11,10,4]
186  ],
187  [
188  [0,1],
189  [0,2],
190  [0,3],
191  [0,4],
192  [1,2],
193  [1,4],
194  [1,5],
195  [2,3],
196  [2,5],
197  [2,6],
198  [2,7],
199  [2,8],
200  [2,9],
201  [2,10],
202  [2,11],
203  [3,4],
204  [3,6],
205  [4,5],
206  [4,6],
207  [4,7],
208  [4,8],
209  [4,9],
210  [4,10],
211  [4,11],
212  [5,7],
213  [6,8],
214  [7,9],
215  [8,10],
216  [9,11],
217  [10,11]
218  ]
219  ],
220  [
221  "hexagonal_bi_pyramid",
222  "Hexagonal Bi-Pyramid",
223  empty_str,
224  "dipyramids",
225  "George W. Hart, 1997. george@li.net",
226  [
227  [-0.28867510881, 0.00000003609, 0.49999997158],
228  [-0.57735022075, -0.00000000361, -0.00000000000],
229  [ 0.00000000000, -1.00000000000, 0.00000000000],
230  [ 0.28867512444, -0.00000000361, 0.49999994993],
231  [ 0.00000000000, 1.00000000000, 0.00000000000],
232  [-0.28867512444, 0.00000000361, -0.49999994993],
233  [ 0.57735022075, 0.00000000361, 0.00000000000],
234  [ 0.28867510881, -0.00000003609, -0.49999997158]
235  ],
236  [
237  [0.57735023169, 179.99999283787, 29.99999919429],
238  [0.57735022075, -179.99999964192, 89.99999999999],
239  [1.00000000000, -89.99999999999, 89.99999999999],
240  [0.57735022075, -0.00000071611, 30.00000161142],
241  [1.00000000000, 89.99999999999, 89.99999999999],
242  [0.57735022075, 179.99999928388, 149.99999838857],
243  [0.57735022075, 0.00000035806, 89.99999999999],
244  [0.57735023169, -0.00000716211, 150.00000080570]
245  ],
246  [
247  [1,0,2],
248  [0,3,2],
249  [1,4,0],
250  [2,5,1],
251  [4,3,0],
252  [6,2,3],
253  [5,4,1],
254  [7,5,2],
255  [4,6,3],
256  [6,7,2],
257  [5,7,4],
258  [7,6,4]
259  ],
260  [
261  [0,1],
262  [0,2],
263  [0,3],
264  [0,4],
265  [1,2],
266  [1,4],
267  [1,5],
268  [2,3],
269  [2,5],
270  [2,6],
271  [2,7],
272  [3,4],
273  [3,6],
274  [4,5],
275  [4,6],
276  [4,7],
277  [5,7],
278  [6,7]
279  ]
280  ],
281  [
282  "octagonal_di_pyramid",
283  "Octagonal Di-Pyramid",
284  empty_str,
285  "dipyramids",
286  "George W. Hart, 1997. george@li.net",
287  [
288  [ 0.14804268343, 0.00000005300, 0.38685420990],
289  [-0.16886526074, 0.00000001992, 0.37822922144],
290  [-0.00000000000, -1.00000000000, -0.00000000000],
291  [ 0.37822922540, 0.00000001750, 0.16886525092],
292  [ 0.00000000000, 1.00000000000, 0.00000000000],
293  [-0.38685424213, -0.00000000493, 0.14804270850],
294  [ 0.38685424213, 0.00000000493, -0.14804270850],
295  [-0.37822922540, -0.00000001750, -0.16886525092],
296  [ 0.16886526074, -0.00000001992, -0.37822922144],
297  [-0.14804268343, -0.00000005300, -0.38685420990]
298  ],
299  [
300  [0.41421349065, 0.00002051089, 20.94101873648],
301  [0.41421349596, 179.99999324038, 24.05898259437],
302  [1.00000000000, -89.99999999999, 89.99999999999],
303  [0.41421349557, 0.00000265101, 65.94101886917],
304  [1.00000000000, 89.99999999999, 89.99999999999],
305  [0.41421352971, -179.99999927041, 69.05897961852],
306  [0.41421352971, 0.00000072957, 110.94102038147],
307  [0.41421349557, -179.99999734898, 114.05898113082],
308  [0.41421349596, -0.00000675961, 155.94101740562],
309  [0.41421349065, -179.99997948910, 159.05898126351]
310  ],
311  [
312  [1,0,2],
313  [0,3,2],
314  [1,4,0],
315  [2,5,1],
316  [4,3,0],
317  [6,2,3],
318  [5,4,1],
319  [7,5,2],
320  [4,6,3],
321  [6,8,2],
322  [5,7,4],
323  [2,9,7],
324  [8,6,4],
325  [9,2,8],
326  [9,4,7],
327  [4,9,8]
328  ],
329  [
330  [0,1],
331  [0,2],
332  [0,3],
333  [0,4],
334  [1,2],
335  [1,4],
336  [1,5],
337  [2,3],
338  [2,5],
339  [2,6],
340  [2,7],
341  [2,8],
342  [2,9],
343  [3,4],
344  [3,6],
345  [4,5],
346  [4,6],
347  [4,7],
348  [4,8],
349  [4,9],
350  [5,7],
351  [6,8],
352  [7,9],
353  [8,9]
354  ]
355  ],
356  [
357  "pentagonal_di_pyramid",
358  "Pentagonal Di-Pyramid",
359  empty_str,
360  "dipyramids",
361  "George W. Hart, 1997. george@li.net",
362  [
363  [ 0.00000000000, 0.00000001425, -0.72654252016],
364  [ 0.69098295556, 0.00000000091, -0.22451392694],
365  [-0.00000009880, -1.00000000000, -0.00000008837],
366  [-0.69098274808, 0.00000008787, -0.22451399518],
367  [ 0.00000000000, 0.99999995655, 0.00000000000],
368  [ 0.42705100182, -0.00000004706, 0.58778529964],
369  [-0.42705111050, -0.00000001253, 0.58778523101]
370  ],
371  [
372  [0.72654252016, 89.99999999999, 179.99999887622],
373  [0.72654246143, 0.00000007552, 107.99999661865],
374  [1.00000000000, -90.00000566107, 90.00000506351],
375  [0.72654228519, 179.99999271350, 108.00000679313],
376  [0.99999995655, 89.99999999999, 89.99999999999],
377  [0.72654257730, -0.00000631324, 35.99999899818],
378  [0.72654258566, -179.99999831890, 36.00000911322]
379  ],
380  [
381  [1,0,2],
382  [0,3,2],
383  [1,4,0],
384  [2,5,1],
385  [4,3,0],
386  [6,2,3],
387  [5,4,1],
388  [6,5,2],
389  [4,6,3],
390  [5,6,4]
391  ],
392  [
393  [0,1],
394  [0,2],
395  [0,3],
396  [0,4],
397  [1,2],
398  [1,4],
399  [1,5],
400  [2,3],
401  [2,5],
402  [2,6],
403  [3,4],
404  [3,6],
405  [4,5],
406  [4,6],
407  [5,6]
408  ]
409  ],
410  [
411  "square_di_pyramid",
412  "Square Di-Pyramid",
413  "Octahedron",
414  "dipyramids",
415  "Exact Mathematics",
416  [
417  [ 0.00000000000, 1.00000000000, 0.00000000000],
418  [-0.70710678119, 0.00000000000, 0.70710678119],
419  [-0.70710678119, 0.00000000000, -0.70710678119],
420  [ 0.70710678119, 0.00000000000, -0.70710678119],
421  [ 0.70710678119, 0.00000000000, 0.70710678119],
422  [ 0.00000000000, -1.00000000000, 0.00000000000]
423  ],
424  [
425  [1.00000000000, 89.99999999999, 89.99999999999],
426  [1.00000000000, 179.99999999999, 45.00000000000],
427  [1.00000000000, 179.99999999999, 134.99999999999],
428  [1.00000000000, 0.00000000000, 134.99999999999],
429  [1.00000000000, 0.00000000000, 45.00000000000],
430  [1.00000000000, -89.99999999999, 89.99999999999]
431  ],
432  [
433  [0,1,2],
434  [0,2,3],
435  [0,3,4],
436  [0,4,1],
437  [5,2,1],
438  [5,3,2],
439  [5,4,3],
440  [5,1,4]
441  ],
442  [
443  [0,1],
444  [0,2],
445  [0,3],
446  [0,4],
447  [1,2],
448  [1,4],
449  [1,5],
450  [2,3],
451  [2,5],
452  [3,4],
453  [3,5],
454  [4,5]
455  ]
456  ],
457  [
458  "triangular_di_pyramid",
459  "Triangular Di-Pyramid",
460  empty_str,
461  "dipyramids",
462  "George W. Hart, 1997. george@li.net",
463  [
464  [-0.00000000000, 0.00000000000, -1.00000000000],
465  [ 0.86602529650, 0.00000016113, 0.49999996108],
466  [ 0.00000012570, -0.57735024545, 0.00000005844],
467  [-0.86602535292, -0.00000013763, 0.50000000631],
468  [-0.00000006928, 0.57735022194, -0.00000002583]
469  ],
470  [
471  [1.00000000000, 179.99999999999, 179.99999999999],
472  [0.99999988763, 0.00001066053, 59.99999885779],
473  [0.57735024545, -89.99998752578, 89.99999420016],
474  [0.99999995911, -179.99999089475, 59.99999823004],
475  [0.57735022194, 90.00000687480, 90.00000256309]
476  ],
477  [
478  [1,0,2],
479  [0,3,2],
480  [1,4,0],
481  [2,3,1],
482  [4,3,0],
483  [3,4,1]
484  ],
485  [
486  [0,1],
487  [0,2],
488  [0,3],
489  [0,4],
490  [1,2],
491  [1,3],
492  [1,4],
493  [2,3],
494  [3,4]
495  ]
496  ]
497 ];
498 
499 //! @}
500 
501 //----------------------------------------------------------------------------//
502 // openscad-amu auxiliary scripts
503 //----------------------------------------------------------------------------//
504 
505 /*
506 BEGIN_SCOPE db;
507 BEGIN_SCOPE autostat;
508  BEGIN_OPENSCAD;
509  include <math/math_polytope.scad>;
510  include <math/math_utility.scad>;
511  include <datatypes/datatypes_table.scad>;
512  include <database/geometry/polyhedra/dipyramids.scad>;
513 
514  fs = "^";
515 
516  tc = dtc_polyhedra_dipyramids;
517  tr = dtr_polyhedra_dipyramids;
518 
519  ids = get_table_ridl(tr);
520 
521  echo
522  (
523  str
524  (
525  "no.", fs, "table id", fs, "other name", fs,
526  "vertices", fs, "faces", fs, "edges",
527 
528  fs, "face-verticies",
529  fs, "face-angles",
530  fs, "edge-lengths",
531  fs, "edge-angles"
532  )
533  );
534 
535  for ( id = ids )
536  {
537  i = first(find(id, ids, c=1))+1;
538 
539  n = get_table_v(tr, tc, id, "n");
540  o = get_table_v(tr, tc, id, "o");
541  g = get_table_v(tr, tc, id, "g");
542  d = get_table_v(tr, tc, id, "d");
543 
544  c = get_table_v(tr, tc, id, "c");
545  s = get_table_v(tr, tc, id, "s");
546  f = get_table_v(tr, tc, id, "f");
547  e = get_table_v(tr, tc, id, "e");
548 
549  fo = is_empty(o) ? "-" : o;
550 
551  echo
552  (
553  str
554  (
555  i, fs, id, fs, fo, fs,
556  len(c), fs, len(f), fs, len(e),
557 
558  fs, hist(qsort(polytope_face_vcounts(f)), m=9),
559  fs, hist(qsort(dround(polytope_face_angles(c, f), d=1)), m=9),
560  fs, hist(qsort(sround(polytope_edge_lengths(c, e), d=3)), m=9),
561  fs, hist(qsort(dround(polytope_edge_angles(c, f), d=1)), m=9),
562 
563  fs
564  )
565  );
566  }
567  END_OPENSCAD;
568 
569  BEGIN_MFSCRIPT;
570  include --path "${INCLUDE_PATH}" {config_base,config_csg}.mfs;
571  include --path "${INCLUDE_PATH}" script_std.mfs;
572  END_MFSCRIPT;
573 END_SCOPE;
574 END_SCOPE;
575 */
576 
577 /*
578 BEGIN_SCOPE db;
579 BEGIN_SCOPE dim;
580  BEGIN_OPENSCAD;
581  include <units/units_coordinate.scad>;
582  include <tools/tools_polytope.scad>;
583  include <datatypes/datatypes_table.scad>;
584  include <database/geometry/polyhedra/dipyramids.scad>;
585 
586  config = 0;
587 
588  tc = dtc_polyhedra_dipyramids;
589  tr = dtr_polyhedra_dipyramids;
590 
591  id = "default";
592  sr = 100;
593 
594  pv = get_table_v(tr, tc, id, "c");
595  pf = get_table_v(tr, tc, id, "f");
596  pe = get_table_v(tr, tc, id, "e");
597 
598  sv = coordinates_csc(pv, sr);
599 
600  if (config == 0) // png preview
601  {
602  $fn = 25;
603 
604  %polyhedron(sv, pf);
605 
606  polytope_frame(sv, pf, pe)
607  {
608  circle(r = sr / 25);
609  color("lightblue")
610  sphere(r = sr / 25 * (1 + 1/2));
611  }
612  }
613 
614  if (config == 1) // stl model
615  {
616  polyhedron(sv, pf);
617  }
618  END_OPENSCAD;
619 
620  BEGIN_MFSCRIPT;
621  include --path "${INCLUDE_PATH}" {config_base,config_png}.mfs;
622 
623  views name "views" views "diag";
624  defines name "ids" define "id"
625  strings
626  "
627  decagonal_bi_pyramid
628  hexagonal_bi_pyramid
629  octagonal_di_pyramid
630  pentagonal_di_pyramid
631  square_di_pyramid
632  triangular_di_pyramid
633  ";
634  variables add_opts_combine "views ids";
635  variables add_opts "-D config=0 --viewall --autocenter";
636 
637  include --path "${INCLUDE_PATH}" script_new.mfs;
638 
639  include --path "${INCLUDE_PATH}" config_stl.mfs;
640  variables add_opts_combine "ids";
641  variables add_opts "-D config=1";
642 
643  include --path "${INCLUDE_PATH}" script_app.mfs;
644  END_MFSCRIPT;
645 END_SCOPE;
646 END_SCOPE;
647 */
648 
649 //----------------------------------------------------------------------------//
650 // end of file
651 //----------------------------------------------------------------------------//
empty_str
A string with no characters (the empty string).
Definition: constants.scad:77
dtr_polyhedra_dipyramids
dtc_polyhedra_dipyramids