omdl  v1.0
OpenSCAD Mechanical Design Library
dipyramids.scad
Go to the documentation of this file.
1 //! Polyhedra data table: \c dipyramids.
2 /***************************************************************************//**
3  \file
4  \author Roy Allen Sutton
5  \date 2017-2023
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  [omdl]: https://github.com/royasutton/omdl
42 
43  [Anthony Thyssen]: http://www.ict.griffith.edu.au/anthony/anthony.html
44  [Studies into Polyhedra]: http://www.ict.griffith.edu.au/anthony/graphics/polyhedra
45 
46  [George W. Hart]: http://www.georgehart.com
47  [Encyclopedia of Polyhedra]: http://www.georgehart.com/virtual-polyhedra/vp.html
48 
49  [Netlib]: http://www.netlib.org
50  [Polyhedron Database]: http://www.netlib.org/polyhedra
51 
52  \amu_pathid parent (++path_parent)
53  \amu_pathid group (++path)
54 
55  \ingroup \amu_eval(${group})
56 *******************************************************************************/
57 
58 //----------------------------------------------------------------------------//
59 /***************************************************************************//**
60  \addtogroup \amu_eval(${group})
61  @{
62  <br>
63  ### Dipyramids ###
64  \amu_include (include/amu/includes_required.amu)
65 
66  \amu_eval
67  (
68  ++global
69  title="Examples"
70  stem=dipyramids scope=db_dim size=qvga view=diag
71  )
72 
73  \amu_define object_stem (${stem}_${scope}_${size}_${view}_${shape})
74  \amu_make files_png (append=db_dim extension=png)
75  \amu_make files_stl (append=db_dim extension=stl)
76  \amu_word files_cnt (words="${files_png}" ++count)
77  \amu_seq cell_num (prefix="(" suffix=")" last="${files_cnt}" ++number)
78  \amu_eval object_prefix (shape="" ${object_stem})
79  \amu_filename cell_txt (files="${files_png}" separator="^" ++stem)
80  \amu_replace cell_id (text="${cell_txt}" search="${object_prefix}" replace="id: ")
81  \amu_replace cell_end (text="${cell_txt}" search="${object_prefix}")
82  \amu_replace cell_end (text="${cell_end}" search="_" replace="<br>")
83  \amu_combine cell_end (p="<center>" s="</center>" j="" f="^" t="^" ${cell_end})
84 
85  \htmlonly
86  \amu_image_table
87  (
88  type=html columns=4 image_width="200" cell_files="${files_png}"
89  table_caption="${title}" cell_captions="${cell_num}"
90  cell_titles="${cell_id}" cell_end="${cell_end}"
91  cell_urls="${files_stl}"
92  )
93  \endhtmlonly
94 
95  \amu_make eps_files (append=db_dim extension=png2eps)
96 
97  \latexonly
98  \amu_image_table
99  (
100  type=latex columns=4 image_width="1.25in" cell_files="${eps_files}"
101  table_caption="${title}" cell_captions="${cell_num}"
102  )
103  \endlatexonly
104 
105  \b Autostats
106 
107  \amu_scope scope (index=1)
108  \amu_file heading (file="${scope}.log" last=1 ++rmecho ++rmnl ++read ++quiet)
109  \amu_file texts (file="${scope}.log" first=2 ++rmecho ++rmnl ++read ++quiet)
110  \amu_word columns (tokenizer="^" words="${heading}" ++count)
111 
112  \amu_table table
113  (
114  columns=${columns} column_headings="${heading}" cell_texts="${texts}"
115  )
116 
117  \amu_if ( -w ${heading} )
118  { ${table} }
119  else
120  { \note Statistics table not available. To build and include, remove
121  \c db_autostat from \c scopes_exclude in library makefile.
122  For more information see \ref lb. }
123  endif
124 *******************************************************************************/
125 //----------------------------------------------------------------------------//
126 
127 //! <map> \c dipyramids polyhedra data table columns definition.
128 //! \hideinitializer
130 [
131  ["id", "identifier"],
132  ["n", "name"],
133  ["o", "other name"],
134  ["g", "group"],
135  ["d", "data source"],
136  ["c", "cartesian vertices"],
137  ["s", "spherical vertices"],
138  ["f", "faces"],
139  ["e", "edges"]
140 ];
141 
142 //! <table> \c dipyramids polyhedra data table rows.
143 //! \hideinitializer
145 [
146  [
147  "decagonal_bi_pyramid",
148  "Decagonal Bi-Pyramid",
149  empty_str,
150  "dipyramids",
151  "George W. Hart, 1997. george@li.net",
152  [
153  [ 0.09592986243, 0.00000000000, 0.31043557716],
154  [-0.10486056224, 0.00000000000, 0.30753382347],
155  [-0.00000000000, -1.00000000000, -0.00000000000],
156  [ 0.26007835274, 0.00000000000, 0.19476148707],
157  [-0.00000000000, 1.00000000000, -0.00000000000],
158  [-0.26559780113, 0.00000000000, 0.18716458288],
159  [ 0.32488563406, 0.00000000000, 0.00469514267],
160  [-0.32488563406, -0.00000000000, -0.00469514267],
161  [ 0.26559780113, -0.00000000000, -0.18716458288],
162  [-0.26007835274, -0.00000000000, -0.19476148707],
163  [ 0.10486056224, -0.00000000000, -0.30753382347],
164  [-0.09592986243, -0.00000000000, -0.31043557716]
165  ],
166  [
167  [0.32491966095, 0.00000000000, 17.17203674418],
168  [0.32491966714, 179.99999999999, 18.82796235856],
169  [1.00000000000, -89.99999999999, 89.99999999999],
170  [0.32491966147, 0.00000000000, 53.17203948142],
171  [1.00000000000, 89.99999999999, 89.99999999999],
172  [0.32491964091, 179.99999999999, 54.82796225358],
173  [0.32491955863, 0.00000000000, 89.17203746329],
174  [0.32491955863, -179.99999999999, 90.82796253670],
175  [0.32491964091, -0.00000000000, 125.17203774641],
176  [0.32491966147, -179.99999999999, 126.82796051856],
177  [0.32491966714, -0.00000000000, 161.17203764143],
178  [0.32491966095, -179.99999999999, 162.82796325581]
179  ],
180  [
181  [1,0,2],
182  [0,3,2],
183  [1,4,0],
184  [2,5,1],
185  [4,3,0],
186  [6,2,3],
187  [5,4,1],
188  [7,5,2],
189  [4,6,3],
190  [6,8,2],
191  [5,7,4],
192  [2,9,7],
193  [8,6,4],
194  [10,2,8],
195  [9,4,7],
196  [11,9,2],
197  [4,10,8],
198  [10,11,2],
199  [9,11,4],
200  [11,10,4]
201  ],
202  [
203  [0,1],
204  [0,2],
205  [0,3],
206  [0,4],
207  [1,2],
208  [1,4],
209  [1,5],
210  [2,3],
211  [2,5],
212  [2,6],
213  [2,7],
214  [2,8],
215  [2,9],
216  [2,10],
217  [2,11],
218  [3,4],
219  [3,6],
220  [4,5],
221  [4,6],
222  [4,7],
223  [4,8],
224  [4,9],
225  [4,10],
226  [4,11],
227  [5,7],
228  [6,8],
229  [7,9],
230  [8,10],
231  [9,11],
232  [10,11]
233  ]
234  ],
235  [
236  "hexagonal_bi_pyramid",
237  "Hexagonal Bi-Pyramid",
238  empty_str,
239  "dipyramids",
240  "George W. Hart, 1997. george@li.net",
241  [
242  [-0.28867510881, 0.00000003609, 0.49999997158],
243  [-0.57735022075, -0.00000000361, -0.00000000000],
244  [ 0.00000000000, -1.00000000000, 0.00000000000],
245  [ 0.28867512444, -0.00000000361, 0.49999994993],
246  [ 0.00000000000, 1.00000000000, 0.00000000000],
247  [-0.28867512444, 0.00000000361, -0.49999994993],
248  [ 0.57735022075, 0.00000000361, 0.00000000000],
249  [ 0.28867510881, -0.00000003609, -0.49999997158]
250  ],
251  [
252  [0.57735023169, 179.99999283787, 29.99999919429],
253  [0.57735022075, -179.99999964192, 89.99999999999],
254  [1.00000000000, -89.99999999999, 89.99999999999],
255  [0.57735022075, -0.00000071611, 30.00000161142],
256  [1.00000000000, 89.99999999999, 89.99999999999],
257  [0.57735022075, 179.99999928388, 149.99999838857],
258  [0.57735022075, 0.00000035806, 89.99999999999],
259  [0.57735023169, -0.00000716211, 150.00000080570]
260  ],
261  [
262  [1,0,2],
263  [0,3,2],
264  [1,4,0],
265  [2,5,1],
266  [4,3,0],
267  [6,2,3],
268  [5,4,1],
269  [7,5,2],
270  [4,6,3],
271  [6,7,2],
272  [5,7,4],
273  [7,6,4]
274  ],
275  [
276  [0,1],
277  [0,2],
278  [0,3],
279  [0,4],
280  [1,2],
281  [1,4],
282  [1,5],
283  [2,3],
284  [2,5],
285  [2,6],
286  [2,7],
287  [3,4],
288  [3,6],
289  [4,5],
290  [4,6],
291  [4,7],
292  [5,7],
293  [6,7]
294  ]
295  ],
296  [
297  "octagonal_di_pyramid",
298  "Octagonal Di-Pyramid",
299  empty_str,
300  "dipyramids",
301  "George W. Hart, 1997. george@li.net",
302  [
303  [ 0.14804268343, 0.00000005300, 0.38685420990],
304  [-0.16886526074, 0.00000001992, 0.37822922144],
305  [-0.00000000000, -1.00000000000, -0.00000000000],
306  [ 0.37822922540, 0.00000001750, 0.16886525092],
307  [ 0.00000000000, 1.00000000000, 0.00000000000],
308  [-0.38685424213, -0.00000000493, 0.14804270850],
309  [ 0.38685424213, 0.00000000493, -0.14804270850],
310  [-0.37822922540, -0.00000001750, -0.16886525092],
311  [ 0.16886526074, -0.00000001992, -0.37822922144],
312  [-0.14804268343, -0.00000005300, -0.38685420990]
313  ],
314  [
315  [0.41421349065, 0.00002051089, 20.94101873648],
316  [0.41421349596, 179.99999324038, 24.05898259437],
317  [1.00000000000, -89.99999999999, 89.99999999999],
318  [0.41421349557, 0.00000265101, 65.94101886917],
319  [1.00000000000, 89.99999999999, 89.99999999999],
320  [0.41421352971, -179.99999927041, 69.05897961852],
321  [0.41421352971, 0.00000072957, 110.94102038147],
322  [0.41421349557, -179.99999734898, 114.05898113082],
323  [0.41421349596, -0.00000675961, 155.94101740562],
324  [0.41421349065, -179.99997948910, 159.05898126351]
325  ],
326  [
327  [1,0,2],
328  [0,3,2],
329  [1,4,0],
330  [2,5,1],
331  [4,3,0],
332  [6,2,3],
333  [5,4,1],
334  [7,5,2],
335  [4,6,3],
336  [6,8,2],
337  [5,7,4],
338  [2,9,7],
339  [8,6,4],
340  [9,2,8],
341  [9,4,7],
342  [4,9,8]
343  ],
344  [
345  [0,1],
346  [0,2],
347  [0,3],
348  [0,4],
349  [1,2],
350  [1,4],
351  [1,5],
352  [2,3],
353  [2,5],
354  [2,6],
355  [2,7],
356  [2,8],
357  [2,9],
358  [3,4],
359  [3,6],
360  [4,5],
361  [4,6],
362  [4,7],
363  [4,8],
364  [4,9],
365  [5,7],
366  [6,8],
367  [7,9],
368  [8,9]
369  ]
370  ],
371  [
372  "pentagonal_di_pyramid",
373  "Pentagonal Di-Pyramid",
374  empty_str,
375  "dipyramids",
376  "George W. Hart, 1997. george@li.net",
377  [
378  [ 0.00000000000, 0.00000001425, -0.72654252016],
379  [ 0.69098295556, 0.00000000091, -0.22451392694],
380  [-0.00000009880, -1.00000000000, -0.00000008837],
381  [-0.69098274808, 0.00000008787, -0.22451399518],
382  [ 0.00000000000, 0.99999995655, 0.00000000000],
383  [ 0.42705100182, -0.00000004706, 0.58778529964],
384  [-0.42705111050, -0.00000001253, 0.58778523101]
385  ],
386  [
387  [0.72654252016, 89.99999999999, 179.99999887622],
388  [0.72654246143, 0.00000007552, 107.99999661865],
389  [1.00000000000, -90.00000566107, 90.00000506351],
390  [0.72654228519, 179.99999271350, 108.00000679313],
391  [0.99999995655, 89.99999999999, 89.99999999999],
392  [0.72654257730, -0.00000631324, 35.99999899818],
393  [0.72654258566, -179.99999831890, 36.00000911322]
394  ],
395  [
396  [1,0,2],
397  [0,3,2],
398  [1,4,0],
399  [2,5,1],
400  [4,3,0],
401  [6,2,3],
402  [5,4,1],
403  [6,5,2],
404  [4,6,3],
405  [5,6,4]
406  ],
407  [
408  [0,1],
409  [0,2],
410  [0,3],
411  [0,4],
412  [1,2],
413  [1,4],
414  [1,5],
415  [2,3],
416  [2,5],
417  [2,6],
418  [3,4],
419  [3,6],
420  [4,5],
421  [4,6],
422  [5,6]
423  ]
424  ],
425  [
426  "square_di_pyramid",
427  "Square Di-Pyramid",
428  "Octahedron",
429  "dipyramids",
430  "Exact Mathematics",
431  [
432  [ 0.00000000000, 1.00000000000, 0.00000000000],
433  [-0.70710678119, 0.00000000000, 0.70710678119],
434  [-0.70710678119, 0.00000000000, -0.70710678119],
435  [ 0.70710678119, 0.00000000000, -0.70710678119],
436  [ 0.70710678119, 0.00000000000, 0.70710678119],
437  [ 0.00000000000, -1.00000000000, 0.00000000000]
438  ],
439  [
440  [1.00000000000, 89.99999999999, 89.99999999999],
441  [1.00000000000, 179.99999999999, 45.00000000000],
442  [1.00000000000, 179.99999999999, 134.99999999999],
443  [1.00000000000, 0.00000000000, 134.99999999999],
444  [1.00000000000, 0.00000000000, 45.00000000000],
445  [1.00000000000, -89.99999999999, 89.99999999999]
446  ],
447  [
448  [0,1,2],
449  [0,2,3],
450  [0,3,4],
451  [0,4,1],
452  [5,2,1],
453  [5,3,2],
454  [5,4,3],
455  [5,1,4]
456  ],
457  [
458  [0,1],
459  [0,2],
460  [0,3],
461  [0,4],
462  [1,2],
463  [1,4],
464  [1,5],
465  [2,3],
466  [2,5],
467  [3,4],
468  [3,5],
469  [4,5]
470  ]
471  ],
472  [
473  "triangular_di_pyramid",
474  "Triangular Di-Pyramid",
475  empty_str,
476  "dipyramids",
477  "George W. Hart, 1997. george@li.net",
478  [
479  [-0.00000000000, 0.00000000000, -1.00000000000],
480  [ 0.86602529650, 0.00000016113, 0.49999996108],
481  [ 0.00000012570, -0.57735024545, 0.00000005844],
482  [-0.86602535292, -0.00000013763, 0.50000000631],
483  [-0.00000006928, 0.57735022194, -0.00000002583]
484  ],
485  [
486  [1.00000000000, 179.99999999999, 179.99999999999],
487  [0.99999988763, 0.00001066053, 59.99999885779],
488  [0.57735024545, -89.99998752578, 89.99999420016],
489  [0.99999995911, -179.99999089475, 59.99999823004],
490  [0.57735022194, 90.00000687480, 90.00000256309]
491  ],
492  [
493  [1,0,2],
494  [0,3,2],
495  [1,4,0],
496  [2,3,1],
497  [4,3,0],
498  [3,4,1]
499  ],
500  [
501  [0,1],
502  [0,2],
503  [0,3],
504  [0,4],
505  [1,2],
506  [1,3],
507  [1,4],
508  [2,3],
509  [3,4]
510  ]
511  ]
512 ];
513 
514 //! @}
515 
516 //----------------------------------------------------------------------------//
517 // openscad-amu auxiliary scripts
518 //----------------------------------------------------------------------------//
519 
520 /*
521 BEGIN_SCOPE db;
522 BEGIN_SCOPE autostat;
523  BEGIN_OPENSCAD;
524  include <omdl-base.scad>;
525  include <database/geometry/polyhedra/dipyramids.scad>;
526 
527  fs = "^";
528 
529  tc = dtc_polyhedra_dipyramids;
530  tr = dtr_polyhedra_dipyramids;
531 
532  ids = table_get_row_ids(tr);
533 
534  echo
535  (
536  str
537  (
538  "no.", fs, "id", fs, "other name", fs,
539  "vertices", fs, "faces", fs, "edges",
540 
541  fs, "face-verticies",
542  fs, "face-angles",
543  fs, "edge-lengths",
544  fs, "edge-angles"
545  )
546  );
547 
548  for ( id = ids )
549  {
550  i = first(find(id, ids, c=1))+1;
551 
552  n = table_get_value(tr, tc, id, "n");
553  o = table_get_value(tr, tc, id, "o");
554  g = table_get_value(tr, tc, id, "g");
555  d = table_get_value(tr, tc, id, "d");
556 
557  c = table_get_value(tr, tc, id, "c");
558  s = table_get_value(tr, tc, id, "s");
559  f = table_get_value(tr, tc, id, "f");
560  e = table_get_value(tr, tc, id, "e");
561 
562  fo = is_empty(o) ? "-" : o;
563 
564  echo
565  (
566  str
567  (
568  i, fs, id, fs, fo, fs,
569  len(c), fs, len(f), fs, len(e),
570 
571  fs, histogram(sort_q(polytope_face_vertex_counts(f)), m=9),
572  fs, histogram(sort_q(round_d(polytope_face_angles(c, f), d=1)), m=9),
573  fs, histogram(sort_q(round_s(polytope_edge_lengths(c, e), d=3)), m=9),
574  fs, histogram(sort_q(round_d(polytope_edge_angles(c, f), d=1)), m=9),
575 
576  fs
577  )
578  );
579  }
580  END_OPENSCAD;
581 
582  BEGIN_MFSCRIPT;
583  include --path "${INCLUDE_PATH}" {var_init,var_gen_term}.mfs;
584  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
585  END_MFSCRIPT;
586 END_SCOPE;
587 END_SCOPE;
588 */
589 
590 /*
591 BEGIN_SCOPE db;
592 BEGIN_SCOPE dim;
593  BEGIN_OPENSCAD;
594  include <omdl-base.scad>;
595  include <units/coordinate.scad>;
596  include <tools/common/polytope.scad>;
597  include <database/geometry/polyhedra/dipyramids.scad>;
598 
599  config = 0;
600 
601  tc = dtc_polyhedra_dipyramids;
602  tr = dtr_polyhedra_dipyramids;
603 
604  id = "default";
605  sr = 100;
606 
607  pv = table_get_value(tr, tc, id, "c");
608  pf = table_get_value(tr, tc, id, "f");
609  pe = table_get_value(tr, tc, id, "e");
610 
611  sv = coordinate_scale3d_csc(pv, sr);
612 
613  if (config == 0) // png preview
614  {
615  $fn = 25;
616 
617  %polyhedron(sv, pf);
618 
619  polytope_frame(sv, pf, pe)
620  {
621  circle(r = sr / 25);
622  color("lightblue")
623  sphere(r = sr / 25 * (1 + 1/2));
624  }
625  }
626 
627  if (config == 1) // stl model
628  {
629  polyhedron(sv, pf);
630  }
631  END_OPENSCAD;
632 
633  BEGIN_MFSCRIPT;
634  include --path "${INCLUDE_PATH}" {var_init,var_gen_png2eps}.mfs;
635 
636  views name "views" views "diag";
637  defines name "ids" define "id"
638  strings
639  "
640  decagonal_bi_pyramid
641  hexagonal_bi_pyramid
642  octagonal_di_pyramid
643  pentagonal_di_pyramid
644  square_di_pyramid
645  triangular_di_pyramid
646  ";
647  variables add_opts_combine "views ids";
648  variables add_opts "-D config=0 --viewall --autocenter --view=axes";
649 
650  include --path "${INCLUDE_PATH}" scr_make_mf_begin.mfs;
651  include --path "${INCLUDE_PATH}" scr_make_mf_add_ext.mfs;
652 
653  include --path "${INCLUDE_PATH}" var_gen_stl.mfs;
654  variables add_opts_combine "ids";
655  variables add_opts "-D config=1";
656 
657  include --path "${INCLUDE_PATH}" scr_make_mf_add_ext.mfs;
658  include --path "${INCLUDE_PATH}" scr_make_mf_end.mfs;
659  END_MFSCRIPT;
660 END_SCOPE;
661 END_SCOPE;
662 */
663 
664 //----------------------------------------------------------------------------//
665 // end of file
666 //----------------------------------------------------------------------------//
empty_str
<string> A string with no characters (the empty string).
Definition: constants.scad:301
dtc_polyhedra_dipyramids
dtr_polyhedra_dipyramids