omdl  v0.6.1
OpenSCAD Mechanical Design Library
pyramids.scad
Go to the documentation of this file.
1 //! Table of polyhedra data group: \c pyramids
2 /***************************************************************************//**
3  \file pyramids.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: pyramids ###
64 
65  \amu_define caption (pyramids)
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 (pyramids)
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/pyramids_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 pyramids 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 pyramids polyhedra data table rows.
128 //! \hideinitializer
130 [
131  [
132  "pentagonal_dipyramid",
133  "Pentagonal Dipyramid",
134  "J13",
135  "pyramids",
136  "Polyhedron Database #57",
137  [
138  [ 0.00000000000, 0.61803398875, 0.00000000000],
139  [ 0.00000000000, -0.00000000000, 1.00000000000],
140  [ 0.95105651630, -0.00000000000, 0.30901699437],
141  [-0.95105651630, -0.00000000000, 0.30901699437],
142  [ 0.58778525229, 0.00000000000, -0.80901699437],
143  [-0.58778525229, -0.00000000000, -0.80901699437],
144  [ 0.00000000000, -0.61803398875, 0.00000000000]
145  ],
146  [
147  [0.61803398875, 89.99999999999, 89.99999999999],
148  [1.00000000000, -0.00000000000, 0.00000000000],
149  [1.00000000000, -0.00000000000, 72.00000000000],
150  [1.00000000000, -179.99999999999, 72.00000000000],
151  [1.00000000000, 0.00000000000, 143.99999999999],
152  [1.00000000000, -179.99999999999, 143.99999999999],
153  [0.61803398875, -89.99999999999, 89.99999999999]
154  ],
155  [
156  [0,2,1],
157  [0,5,4],
158  [0,4,2],
159  [0,1,3],
160  [0,3,5],
161  [6,1,2],
162  [6,4,5],
163  [6,2,4],
164  [6,3,1],
165  [6,5,3]
166  ],
167  [
168  [0,1],
169  [0,2],
170  [0,3],
171  [0,4],
172  [0,5],
173  [1,2],
174  [1,3],
175  [1,6],
176  [2,4],
177  [2,6],
178  [3,5],
179  [3,6],
180  [4,5],
181  [4,6],
182  [5,6]
183  ]
184  ],
185  [
186  "pentagonal_pyramid",
187  "Pentagonal Pyramid",
188  "J2",
189  "pyramids",
190  "Polyhedron Database #46",
191  [
192  [ 0.00000000000, 0.51231760759, 0.00000000000],
193  [ 0.00000000000, -0.10246352152, 0.99473676254],
194  [ 0.94605088002, -0.10246352152, 0.30739056456],
195  [-0.94605088002, -0.10246352152, 0.30739056456],
196  [ 0.58469159894, -0.10246352152, -0.80475894583],
197  [-0.58469159894, -0.10246352152, -0.80475894583]
198  ],
199  [
200  [0.51231760759, 89.99999999999, 89.99999999999],
201  [1.00000000000, -89.99999999999, 5.88104874729],
202  [1.00000000000, -6.18141426337, 72.09795604403],
203  [1.00000000000, -173.81858573661, 72.09795604404],
204  [1.00000000000, -9.93979324212, 143.58698182134],
205  [1.00000000000, -170.06020675786, 143.58698182134]
206  ],
207  [
208  [0,2,1],
209  [0,5,4],
210  [0,4,2],
211  [0,1,3],
212  [0,3,5],
213  [1,2,4,5,3]
214  ],
215  [
216  [0,1],
217  [0,2],
218  [0,3],
219  [0,4],
220  [0,5],
221  [1,2],
222  [1,3],
223  [2,4],
224  [3,5],
225  [4,5]
226  ]
227  ],
228  [
229  "square_dipryamid",
230  "Square Dipryamid",
231  "Octahedron",
232  "pyramids",
233  "Exact Mathematics",
234  [
235  [ 0.00000000000, 1.00000000000, 0.00000000000],
236  [-1.00000000000, 0.00000000000, 0.00000000000],
237  [ 0.00000000000, 0.00000000000, -1.00000000000],
238  [ 1.00000000000, 0.00000000000, 0.00000000000],
239  [ 0.00000000000, 0.00000000000, 1.00000000000],
240  [ 0.00000000000, -1.00000000000, 0.00000000000]
241  ],
242  [
243  [1.00000000000, 89.99999999999, 89.99999999999],
244  [1.00000000000, 179.99999999999, 89.99999999999],
245  [1.00000000000, 0.00000000000, 179.99999999999],
246  [1.00000000000, 0.00000000000, 89.99999999999],
247  [1.00000000000, 0.00000000000, 0.00000000000],
248  [1.00000000000, -89.99999999999, 89.99999999999]
249  ],
250  [
251  [0,1,2],
252  [0,2,3],
253  [0,3,4],
254  [0,4,1],
255  [5,2,1],
256  [5,3,2],
257  [5,4,3],
258  [5,1,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  [3,4],
271  [3,5],
272  [4,5]
273  ]
274  ],
275  [
276  "square_pyramid",
277  "Square Pyramid",
278  "J1",
279  "pyramids",
280  "Exact Mathematics",
281  [
282  [ 0.00000000000, 1.00000000000, 0.00000000000],
283  [-1.00000000000, 0.00000000000, 0.00000000000],
284  [ 0.00000000000, 0.00000000000, -1.00000000000],
285  [ 1.00000000000, 0.00000000000, 0.00000000000],
286  [ 0.00000000000, 0.00000000000, 1.00000000000]
287  ],
288  [
289  [1.00000000000, 89.99999999999, 89.99999999999],
290  [1.00000000000, 179.99999999999, 89.99999999999],
291  [1.00000000000, 0.00000000000, 179.99999999999],
292  [1.00000000000, 0.00000000000, 89.99999999999],
293  [1.00000000000, 0.00000000000, 0.00000000000]
294  ],
295  [
296  [0,1,2],
297  [0,2,3],
298  [0,3,4],
299  [0,4,1],
300  [4,3,2,1]
301  ],
302  [
303  [0,1],
304  [0,2],
305  [0,3],
306  [0,4],
307  [1,2],
308  [1,4],
309  [2,3],
310  [3,4]
311  ]
312  ],
313  [
314  "triangular_dipyramid",
315  "Triangular Dipyramid",
316  "J12",
317  "pyramids",
318  "Exact Mathematics",
319  [
320  [ 0.00000000000, 1.00000000000, 0.00000000000],
321  [-0.61237243570, 0.00000000000, 0.35355339059],
322  [ 0.61237243570, 0.00000000000, 0.35355339059],
323  [ 0.00000000000, 0.00000000000, -0.70710678119],
324  [ 0.00000000000, -1.00000000000, 0.00000000000]
325  ],
326  [
327  [1.00000000000, 89.99999999999, 89.99999999999],
328  [0.70710678119, 179.99999999999, 59.99999999999],
329  [0.70710678119, 0.00000000000, 59.99999999999],
330  [0.70710678119, 0.00000000000, 179.99999999999],
331  [1.00000000000, -89.99999999999, 89.99999999999]
332  ],
333  [
334  [0,2,1],
335  [0,1,3],
336  [0,3,2],
337  [4,1,2],
338  [4,3,1],
339  [4,2,3]
340  ],
341  [
342  [0,1],
343  [0,2],
344  [0,3],
345  [1,2],
346  [1,3],
347  [1,4],
348  [2,3],
349  [2,4],
350  [3,4]
351  ]
352  ],
353  [
354  "triangular_pyramid",
355  "Triangular Pyramid",
356  "Tetrahedron",
357  "pyramids",
358  "Exact Mathematics",
359  [
360  [ 0.00000000000, 1.00000000000, 0.00000000000],
361  [-0.81649658093, -0.33333333333, 0.47140452079],
362  [ 0.81649658093, -0.33333333333, 0.47140452079],
363  [-0.00000000000, -0.33333333333, -0.94280904158]
364  ],
365  [
366  [1.00000000000, 89.99999999999, 89.99999999999],
367  [1.00000000000, -157.79234570139, 61.87449429794],
368  [1.00000000000, -22.20765429859, 61.87449429794],
369  [1.00000000000, -89.99999999999, 160.52877936550]
370  ],
371  [
372  [0,2,1],
373  [0,1,3],
374  [0,3,2],
375  [1,2,3]
376  ],
377  [
378  [0,1],
379  [0,2],
380  [0,3],
381  [1,2],
382  [1,3],
383  [2,3]
384  ]
385  ]
386 ];
387 
388 //! @}
389 
390 //----------------------------------------------------------------------------//
391 // openscad-amu auxiliary scripts
392 //----------------------------------------------------------------------------//
393 
394 /*
395 BEGIN_SCOPE db;
396 BEGIN_SCOPE autostat;
397  BEGIN_OPENSCAD;
398  include <math/math_polytope.scad>;
399  include <math/math_utility.scad>;
400  include <datatypes/datatypes_table.scad>;
401  include <database/geometry/polyhedra/pyramids.scad>;
402 
403  fs = "^";
404 
405  tc = dtc_polyhedra_pyramids;
406  tr = dtr_polyhedra_pyramids;
407 
408  ids = get_table_ridl(tr);
409 
410  echo
411  (
412  str
413  (
414  "no.", fs, "table id", fs, "other name", fs,
415  "vertices", fs, "faces", fs, "edges",
416 
417  fs, "face-verticies",
418  fs, "face-angles",
419  fs, "edge-lengths",
420  fs, "edge-angles"
421  )
422  );
423 
424  for ( id = ids )
425  {
426  i = first(find(id, ids, c=1))+1;
427 
428  n = get_table_v(tr, tc, id, "n");
429  o = get_table_v(tr, tc, id, "o");
430  g = get_table_v(tr, tc, id, "g");
431  d = get_table_v(tr, tc, id, "d");
432 
433  c = get_table_v(tr, tc, id, "c");
434  s = get_table_v(tr, tc, id, "s");
435  f = get_table_v(tr, tc, id, "f");
436  e = get_table_v(tr, tc, id, "e");
437 
438  fo = is_empty(o) ? "-" : o;
439 
440  echo
441  (
442  str
443  (
444  i, fs, id, fs, fo, fs,
445  len(c), fs, len(f), fs, len(e),
446 
447  fs, hist(qsort(polytope_face_vcounts(f)), m=9),
448  fs, hist(qsort(dround(polytope_face_angles(c, f), d=1)), m=9),
449  fs, hist(qsort(sround(polytope_edge_lengths(c, e), d=3)), m=9),
450  fs, hist(qsort(dround(polytope_edge_angles(c, f), d=1)), m=9),
451 
452  fs
453  )
454  );
455  }
456  END_OPENSCAD;
457 
458  BEGIN_MFSCRIPT;
459  include --path "${INCLUDE_PATH}" {config_base,config_csg}.mfs;
460  include --path "${INCLUDE_PATH}" script_std.mfs;
461  END_MFSCRIPT;
462 END_SCOPE;
463 END_SCOPE;
464 */
465 
466 /*
467 BEGIN_SCOPE db;
468 BEGIN_SCOPE dim;
469  BEGIN_OPENSCAD;
470  include <units/units_coordinate.scad>;
471  include <tools/tools_polytope.scad>;
472  include <datatypes/datatypes_table.scad>;
473  include <database/geometry/polyhedra/pyramids.scad>;
474 
475  config = 0;
476 
477  tc = dtc_polyhedra_pyramids;
478  tr = dtr_polyhedra_pyramids;
479 
480  id = "default";
481  sr = 100;
482 
483  pv = get_table_v(tr, tc, id, "c");
484  pf = get_table_v(tr, tc, id, "f");
485  pe = get_table_v(tr, tc, id, "e");
486 
487  sv = coordinates_csc(pv, sr);
488 
489  if (config == 0) // png preview
490  {
491  $fn = 25;
492 
493  %polyhedron(sv, pf);
494 
495  polytope_frame(sv, pf, pe)
496  {
497  circle(r = sr / 25);
498  color("lightblue")
499  sphere(r = sr / 25 * (1 + 1/2));
500  }
501  }
502 
503  if (config == 1) // stl model
504  {
505  polyhedron(sv, pf);
506  }
507  END_OPENSCAD;
508 
509  BEGIN_MFSCRIPT;
510  include --path "${INCLUDE_PATH}" {config_base,config_png}.mfs;
511 
512  views name "views" views "diag";
513  defines name "ids" define "id"
514  strings
515  "
516  pentagonal_dipyramid
517  pentagonal_pyramid
518  square_dipryamid
519  square_pyramid
520  triangular_dipyramid
521  triangular_pyramid
522  ";
523  variables add_opts_combine "views ids";
524  variables add_opts "-D config=0 --viewall --autocenter";
525 
526  include --path "${INCLUDE_PATH}" script_new.mfs;
527 
528  include --path "${INCLUDE_PATH}" config_stl.mfs;
529  variables add_opts_combine "ids";
530  variables add_opts "-D config=1";
531 
532  include --path "${INCLUDE_PATH}" script_app.mfs;
533  END_MFSCRIPT;
534 END_SCOPE;
535 END_SCOPE;
536 */
537 
538 //----------------------------------------------------------------------------//
539 // end of file
540 //----------------------------------------------------------------------------//
dtc_polyhedra_pyramids
Definition: pyramids.scad:114
dtr_polyhedra_pyramids
Definition: pyramids.scad:129