omdl  v0.5
OpenSCAD Mechanical Design Library
shapes3d.scad
Go to the documentation of this file.
1 //! Three-dimensional basic shapes.
2 /***************************************************************************//**
3  \file shapes3d.scad
4  \author Roy Allen Sutton
5  \date 2015-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  \todo Complete rounded cylinder.
31 
32  \ingroup shapes shapes_3d
33 *******************************************************************************/
34 
35 include <shapes2d.scad>;
36 
37 //----------------------------------------------------------------------------//
38 /***************************************************************************//**
39  \addtogroup shapes
40  @{
41 
42  \amu_define caption (3D Shapes)
43 
44  \amu_make png_files (append=dim extension=png)
45  \amu_make eps_files (append=dim extension=png2eps)
46  \amu_shell file_cnt ("echo ${png_files} | wc -w")
47  \amu_shell cell_num ("seq -f '(%g)' -s '^' ${file_cnt}")
48 
49  \htmlonly
50  \amu_image_table
51  (
52  type=html columns=4 image_width="200" cell_files="${png_files}"
53  table_caption="${caption}" cell_captions="${cell_num}"
54  )
55  \endhtmlonly
56  \latexonly
57  \amu_image_table
58  (
59  type=latex columns=4 image_width="1.25in" cell_files="${eps_files}"
60  table_caption="${caption}" cell_captions="${cell_num}"
61  )
62  \endlatexonly
63 
64  \defgroup shapes_3d 3D Shapes
65  \brief Three dimensional geometric shapes.
66  @{
67 *******************************************************************************/
68 //----------------------------------------------------------------------------//
69 
70 //----------------------------------------------------------------------------//
71 // amu macros
72 //----------------------------------------------------------------------------//
73 /***************************************************************************//**
74  \amu_define scope (shapes3d_dim)
75  \amu_define tuple (qvga_diag)
76 
77  \amu_define example_dim
78  (
79  \image html ${scope}_${tuple}_${function}.png "${function}"
80  \image latex ${scope}_${tuple}_${function}.eps "${function}" width=2.5in
81  \dontinclude ${scope}.scad \skipline ${function}(
82  )
83 *******************************************************************************/
84 //----------------------------------------------------------------------------//
85 
86 //! A cone.
87 /***************************************************************************//**
88  \param r <decimal> The base radius.
89  \param h <decimal> The height.
90 
91  \param d <decimal> The base diameter.
92 
93  \param vr <decimal> The default corner rounding radius.
94  \param vr1 <decimal> The base corner rounding radius.
95  \param vr2 <decimal> The point corner rounding radius.
96 
97  \details
98 
99  \b Example
100  \amu_eval ( function=cone ${example_dim} )
101 *******************************************************************************/
102 module cone
103 (
104  r,
105  h,
106  d,
107  vr,
108  vr1,
109  vr2
110 )
111 {
112  cr = defined_or(r, d/2);
113 
114  br = defined_or(vr1, vr);
115  pr = defined_or(vr2, vr);
116 
117  if ( any_undefined([br, pr]) )
118  {
119  cylinder(h=h, r1=cr, r2=0, center=false);
120  }
121  else
122  {
123  hl = sqrt(cr*cr + h*h);
124 
125  rotate_extrude(angle=360)
126  translate([-cr, 0])
127  difference()
128  {
129  triangle_lll( s1=cr*2, s2=hl, s3=hl, v1r=br, v2r=br, v3r=pr );
130  square( size=[cr,h], center=false );
131  }
132  }
133 }
134 
135 //! A cuboid with edge, fillet, or chamfer corners.
136 /***************************************************************************//**
137  \param size <vector|decimal> A vector [x, y, z] of decimals or a
138  single decimal for (x=y=z).
139 
140  \param vr <decimal> The rounding radius.
141 
142  \param vrm <integer> The radius mode.
143  A 2-bit encoded integer that indicates edge and vertex finish.
144  \em B0 controls edge and \em B1 controls vertex.
145 
146  \param center <boolean> Center about origin.
147 
148  \details
149 
150  \b Example
151  \amu_eval ( function=cuboid ${example_dim} )
152 
153  | vrm | B1 | B0 | Description |
154  |:---:|:---:|:---:|:--------------------------------------------|
155  | 0 | 0 | 0 | \em fillet edges with \em fillet vertexes |
156  | 1 | 0 | 1 | \em chamfer edges with \em sphere vertexes |
157  | 2 | 1 | 0 | \em fillet edges with \em chamfer vertexes |
158  | 3 | 1 | 1 | \em chamfer edges with \em chamfer vertexes |
159 
160  \note Using \em fillet replaces all edges with a quarter circle
161  of radius \p vr, inset <tt>[vr, vr]</tt> from the each edge.
162  \note Using \em chamfer replaces all edges with isosceles right
163  triangles with side lengths equal to the corner rounding
164  radius \p vr. Therefore the chamfer length will be
165  <tt>vr*sqrt(2)</tt> at 45 degree angles.
166 *******************************************************************************/
167 module cuboid
168 (
169  size,
170  vr,
171  vrm = 0,
172  center = false
173 )
174 {
175  bx = edefined_or(size, 0, size);
176  by = edefined_or(size, 1, bx);
177  bz = edefined_or(size, 2, by);
178 
179  ef = bitwise_is_equal(vrm, 0, 0);
180  vf = bitwise_is_equal(vrm, 1, 0);
181 
182  translate(center==true ? origin3d : [bx/2, by/2, bz/2])
183  if ( not_defined(vr) )
184  {
185  cube([bx, by, bz], center=true);
186  }
187  else
188  {
189  cube([bx, by-vr*2, bz-vr*2], center=true);
190  cube([bx-vr*2, by, bz-vr*2], center=true);
191  cube([bx-vr*2, by-vr*2, bz ], center=true);
192 
193  bv = [bx, by, bz];
194  rot = [[0,0,0], [90,0,90], [90,90,0]];
195 
196  for ( axis = [0:2] )
197  {
198  zo = bv[(axis+2)%3]/2 - vr;
199 
200  for ( x = [1,-1], y = [1,-1] )
201  {
202  rotate( rot[axis] )
203  translate( [x*(bv[axis]/2-vr), y*(bv[(axis+1)%3]/2-vr), 0] )
204  if ( ef )
205  {
206  cylinder( h=zo*2, r=vr, center=true );
207  }
208  else
209  {
210  polyhedron
211  (
212  points =
213  [
214  [-eps,-eps,+zo], [(vr+eps)*x,-eps,+zo], [-eps,(vr+eps)*y,+zo],
215  [-eps,-eps,-zo], [(vr+eps)*x,-eps,-zo], [-eps,(vr+eps)*y,-zo],
216  ],
217  faces = [[0,2,1], [0,1,4,3], [1,2,5,4], [2,0,3,5], [3,4,5]]
218  );
219  }
220  }
221  }
222 
223  for ( x = [1,-1], y = [1,-1], z = [1,-1] )
224  {
225  translate([x*(bx/2-vr), y*(by/2-vr), z*(bz/2-vr)])
226  if ( vf )
227  {
228  sphere(vr);
229  }
230  else
231  {
232  polyhedron
233  (
234  points = [[0,0,0], [vr*x,0,0], [0,vr*y,0], [0,0,vr*z]],
235  faces = [[1,2,3], [0,2,1], [0,3,2], [0,1,3]]
236  );
237  }
238  }
239  }
240 }
241 
242 //! An ellipsoid.
243 /***************************************************************************//**
244  \param size <vector|decimal> A vector [w, h] of decimals or a
245  single decimal for (w=h).
246 
247  \details
248 
249  \b Example
250  \amu_eval ( function=ellipsoid ${example_dim} )
251 *******************************************************************************/
252 module ellipsoid
253 (
254  size
255 )
256 {
257  w = edefined_or(size, 0, size);
258  h = edefined_or(size, 1, w);
259 
260  if (w == h)
261  {
262  sphere( d=w );
263  }
264  else
265  {
266  scale( [1, 1, h/w] )
267  sphere( r = w/2 );
268  }
269 }
270 
271 //! A sector of an ellipsoid.
272 /***************************************************************************//**
273  \param size <vector|decimal> A vector [w, h] of decimals or a
274  single decimal for (w=h).
275 
276  \param a1 <decimal> The start angle in degrees.
277  \param a2 <decimal> The stop angle in degrees.
278 
279  \details
280 
281  \b Example
282  \amu_eval ( function=ellipsoid_s ${example_dim} )
283 *******************************************************************************/
284 module ellipsoid_s
285 (
286  size,
287  a1 = 0,
288  a2 = 0
289 )
290 {
291  w = edefined_or(size, 0, size);
292  h = edefined_or(size, 1, w);
293 
294  trx = w/2 * sqrt(2) + 1;
295  try = w/2 * sqrt(2) + 1;
296 
297  pa0 = (4 * a1 + 0 * a2) / 4;
298  pa1 = (3 * a1 + 1 * a2) / 4;
299  pa2 = (2 * a1 + 2 * a2) / 4;
300  pa3 = (1 * a1 + 3 * a2) / 4;
301  pa4 = (0 * a1 + 4 * a2) / 4;
302 
303  if (a2 > a1)
304  {
305  intersection()
306  {
307  ellipsoid(size);
308 
309  translate([0,0,-h/2])
310  linear_extrude(height=h)
311  polygon
312  ([
313  origin2d,
314  [trx * cos(pa0), try * sin(pa0)],
315  [trx * cos(pa1), try * sin(pa1)],
316  [trx * cos(pa2), try * sin(pa2)],
317  [trx * cos(pa3), try * sin(pa3)],
318  [trx * cos(pa4), try * sin(pa4)],
319  origin2d
320  ]);
321  }
322  }
323  else
324  {
325  ellipsoid(size);
326  }
327 }
328 
329 //! A pyramid with trilateral base formed by four equilateral triangles.
330 /***************************************************************************//**
331  \param size <decimal> The face radius.
332 
333  \param center <boolean> Center about origin.
334 
335  \details
336 
337  \b Example
338  \amu_eval ( function=tetrahedron ${example_dim} )
339 
340  \todo Support vertex rounding radius.
341 *******************************************************************************/
342 module tetrahedron
343 (
344  size,
345  center = false
346 )
347 {
348  o = size/2;
349  a = size*sqrt(3)/2;
350 
351  translate(center==true ? origin3d : [0,0,o])
352 
353  polyhedron
354  (
355  points =
356  [
357  [-a, -o, -o],
358  [ a, -o, -o],
359  [ 0, size, -o],
360  [ 0, 0, size]
361  ],
362  faces =
363  [
364  [0, 2, 1],
365  [1, 2, 3],
366  [0, 1, 3],
367  [0, 3, 2]
368  ]
369  );
370 }
371 
372 //! A pyramid with quadrilateral base.
373 /***************************************************************************//**
374  \param size <vector|decimal> A vector [x, y, z] of decimals or a
375  single decimal for (x=y=z).
376 
377  \param center <boolean> Center about origin.
378 
379  \details
380 
381  \b Example
382  \amu_eval ( function=pyramid_q ${example_dim} )
383 
384  \todo Support vertex rounding radius.
385 *******************************************************************************/
386 module pyramid_q
387 (
388  size,
389  center = false
390 )
391 {
392  tw = edefined_or(size, 0, size)/2;
393  th = edefined_or(size, 1, tw*2)/2;
394  ph = edefined_or(size, 2, th*2);
395 
396  translate(center==true ? [0,0,-ph/2] : origin3d)
397  polyhedron
398  (
399  points=
400  [
401  [-tw, -th, 0],
402  [-tw, th, 0],
403  [ tw, th, 0],
404  [ tw, -th, 0],
405  [ 0, 0, ph]
406  ],
407  faces=
408  [
409  [0, 3, 2, 1],
410  [0, 1, 4],
411  [1, 2, 4],
412  [2, 3, 4],
413  [3, 0, 4]
414  ]
415  );
416 }
417 
418 //! A three dimensional star.
419 /***************************************************************************//**
420  \param size <vector|decimal> A vector [l, w, h] of decimals
421  or a single decimal for (size=l=2*w=4*h).
422 
423  \param n <decimal> The number of points.
424 
425  \param half <boolean> Render upper half only.
426 
427  \details
428 
429  \b Example
430  \amu_eval ( function=star3d ${example_dim} )
431 *******************************************************************************/
432 module star3d
433 (
434  size,
435  n = 5,
436  half = false
437 )
438 {
439  l = edefined_or(size, 0, size);
440  w = edefined_or(size, 1, l/2);
441  h = edefined_or(size, 2, w/2);
442 
443  if (half == true)
444  {
445  difference()
446  {
447  st_radial_copy(n=n, angle=true, move=false)
448  scale([1, 1, h/w])
449  rotate([45, 0, 0])
450  rotate([0, 90, 0])
451  pyramid_q(size=[w, w, l], center=false);
452 
453  translate([0,0,-h/2])
454  cylinder(r=l, h=h, center=true);
455  }
456  }
457  else
458  {
459  st_radial_copy(n=n, angle=true, move=false)
460  scale([1, 1, h/w])
461  rotate([45, 0, 0])
462  rotate([0, 90, 0])
463  pyramid_q(size=[w, w, l], center=false);
464  }
465 }
466 
467 //! A rectangular cross-sectional profile revolved about the z-axis.
468 /***************************************************************************//**
469  \param size <vector|decimal> The profile size. A vector [x, y] of decimals
470  or a single decimal for (x=y).
471  \param core <vector|decimal> The profile core. A vector [x, y] of decimals
472  or a single decimal for (x=y).
473 
474  \param r <decimal> The rotation radius.
475  \param l <vector|decimal> The elongation length.
476  A vector [x, y] of decimals or a single decimal for (x=y)
477 
478  \param t <vector|decimal> The profile thickness. A vector [x, y] of decimals
479  or a single decimal for (x=y).
480 
481  \param co <vector> Core offset. A vector [x, y] of decimals.
482  \param cr <decimal> Core z-rotation.
483 
484  \param vr <vector|decimal> The profile default corner rounding radius.
485  A vector [v1r, v2r, v3r, v4r] of decimals or a single decimal
486  for (v1r=v2r=v3r=v4r). Unspecified corners are not rounded.
487  \param vr1 <vector|decimal> The profile outer corner rounding radius.
488  \param vr2 <vector|decimal> The profile core corner rounding radius.
489 
490  \param vrm <integer> The default corner radius mode.
491  A 4-bit encoded integer that indicates each corner finish.
492  Use bit value \b 0 for \em fillet and \b 1 for \em chamfer.
493  \param vrm1 <integer> The outer corner radius mode.
494  \param vrm2 <integer> The core corner radius mode.
495 
496  \param pa <decimal> The profile pitch angle in degrees.
497  \param ra <decimal> The rotation sweep angle in degrees.
498  \param m <integer> The section render mode. An 8-bit encoded integer
499  that indicates the revolution sections to render.
500 
501  \param center <boolean> Rotate about profile center.
502  \param profile <boolean> Show profile only (do not extrude).
503 
504  \details
505 
506  \sa st_rotate_extrude_elongate for description of extrude parameters.
507 
508  Thickness \p t
509  \li <tt>core = size - t</tt>; when \p t and \p size are given.
510  \li <tt>size = core + t</tt>; when \p t and \p core are given.
511 
512  \b Example
513  \amu_eval ( function=torus_rp ${example_dim} )
514 *******************************************************************************/
515 module torus_rp
516 (
517  size,
518  core,
519  r,
520  l,
521  t,
522  co,
523  cr = 0,
524  vr,
525  vr1,
526  vr2,
527  vrm = 0,
528  vrm1,
529  vrm2,
530  pa = 0,
531  ra = 360,
532  m = 255,
533  center = false,
534  profile = false
535 )
536 {
537  st_rotate_extrude_elongate( r=r, l=l, pa=pa, ra=ra, m=m, profile=profile )
539  (
540  size=size, core=core, t=t,
541  co=co, cr=cr,
542  vr=vr, vr1=vr1, vr2=vr2,
543  vrm=vrm, vrm1=vrm1, vrm2=vrm2,
544  center=center
545  );
546 }
547 
548 //! A triangular cross-sectional profile revolved about the z-axis.
549 /***************************************************************************//**
550  \param size <vector|decimal> The size. A vector [s1, s2, s3] of decimals
551  or a single decimal for (s1=s2=s3).
552  \param core <vector|decimal> The core. A vector [s1, s2, s3] of decimals
553  or a single decimal for (s1=s2=s3).
554 
555  \param r <decimal> The rotation radius.
556  \param l <vector|decimal> The elongation length.
557  A vector [x, y] of decimals or a single decimal for (x=y)
558 
559  \param co <vector> Core offset. A vector [x, y] of decimals.
560  \param cr <decimal> Core z-rotation.
561 
562  \param vr <vector|decimal> The default vertex rounding radius. A vector
563  [v1r, v2r, v3r] of decimals or a single decimal for (v1r=v2r=v3r).
564  \param vr1 <vector|decimal> The outer vertex rounding radius.
565  \param vr2 <vector|decimal> The core vertex rounding radius.
566 
567  \param pa <decimal> The profile pitch angle in degrees.
568  \param ra <decimal> The rotation sweep angle in degrees.
569  \param m <integer> The section render mode. An 8-bit encoded integer
570  that indicates the revolution sections to render.
571 
572  \param centroid <boolean> Rotate about profile centroid.
573  \param incenter <boolean> Rotate about profile incenter.
574  \param profile <boolean> Show profile only (do not extrude).
575 
576  \details
577 
578  \sa st_rotate_extrude_elongate for description of extrude parameters.
579 
580  \b Example
581  \amu_eval ( function=torus_tp ${example_dim} )
582 
583  \note The outer and inner triangles centroids are aligned prior to the
584  core removal.
585 *******************************************************************************/
586 module torus_tp
587 (
588  size,
589  core,
590  r,
591  l,
592  co,
593  cr = 0,
594  vr,
595  vr1,
596  vr2,
597  pa = 0,
598  ra = 360,
599  m = 255,
600  centroid = false,
601  incenter = false,
602  profile = false,
603 )
604 {
605  st_rotate_extrude_elongate( r=r, l=l, pa=pa, ra=ra, m=m, profile=profile )
607  (
608  vs=size, vc=core,
609  co=co, cr=cr,
610  vr=vr, vr1=vr1, vr2=vr2,
611  centroid=centroid, incenter=incenter
612  );
613 }
614 
615 //! An elliptical cross-sectional profile revolved about the z-axis.
616 /***************************************************************************//**
617  \param size <vector|decimal> The profile size. A vector [x, y] of decimals
618  or a single decimal for (x=y).
619  \param core <vector|decimal> The profile core. A vector [x, y] of decimals
620  or a single decimal for (x=y).
621 
622  \param r <decimal> The rotation radius.
623  \param l <vector|decimal> The elongation length.
624  A vector [x, y] of decimals or a single decimal for (x=y)
625 
626  \param t <vector|decimal> The profile thickness. A vector [x, y] of decimals
627  or a single decimal for (x=y).
628 
629  \param a1 <decimal> The profile start angle in degrees.
630  \param a2 <decimal> The profile stop angle in degrees.
631 
632  \param co <vector> Core offset. A vector [x, y] of decimals.
633  \param cr <decimal> Core z-rotation.
634 
635  \param pa <decimal> The profile pitch angle in degrees.
636  \param ra <decimal> The rotation sweep angle in degrees.
637  \param m <integer> The section render mode. An 8-bit encoded integer
638  that indicates the revolution sections to render.
639 
640  \param profile <boolean> Show profile only (do not extrude).
641 
642  \details
643 
644  \sa st_rotate_extrude_elongate for description of extrude parameters.
645 
646  Thickness \p t
647  \li <tt>core = size - t</tt>; when \p t and \p size are given.
648  \li <tt>size = core + t</tt>; when \p t and \p core are given.
649 
650  \b Example
651  \amu_eval ( function=torus_ep ${example_dim} )
652 *******************************************************************************/
653 module torus_ep
654 (
655  size,
656  core,
657  r,
658  l,
659  t,
660  a1 = 0,
661  a2 = 0,
662  co,
663  cr = 0,
664  pa = 0,
665  ra = 360,
666  m = 255,
667  profile = false
668 )
669 {
670  st_rotate_extrude_elongate( r=r, l=l, pa=pa, ra=ra, m=m, profile=profile )
671  ellipse_cs
672  (
673  size=size, core=core, t=t,
674  a1=a1, a2=a2,
675  co=co, cr=cr
676  );
677 }
678 
679 //! @}
680 //! @}
681 
682 //----------------------------------------------------------------------------//
683 // openscad-amu auxiliary scripts
684 //----------------------------------------------------------------------------//
685 
686 /*
687 BEGIN_SCOPE dim;
688  BEGIN_OPENSCAD;
689  include <shapes3d.scad>;
690 
691  shape = "cuboid";
692  $fn = 72;
693 
694  if (shape == "cone")
695  cone( h=25, r=10, vr=2 );
696  else if (shape == "cuboid")
697  cuboid( size=[25,40,20], vr=5, center=true );
698  else if (shape == "ellipsoid")
699  ellipsoid( size=[40,25] );
700  else if (shape == "ellipsoid_s")
701  ellipsoid_s( size=[60,15], a1=0, a2=270 );
702  else if (shape == "tetrahedron")
703  tetrahedron( size=20, center=true );
704  else if (shape == "pyramid_q")
705  pyramid_q( size=[35,20,5], center=true );
706  else if (shape == "star3d")
707  star3d( size=40, n=5, half=true );
708  else if (shape == "torus_rp")
709  torus_rp( size=[40,20], core=[35,20], r=40, l=[90,60], co=[0,2.5], vr=4, vrm=15, center=true );
710  else if (shape == "torus_tp")
711  torus_tp( size=40, core=30, r=60, co=[0,-4], vr=4, pa=90, ra=270, centroid=true );
712  else if (shape == "torus_ep")
713  torus_ep( size=[20,15], t=[2,4], r=50, a1=0, a2=180, pa=90, ra=270, co=[0,2] );
714  END_OPENSCAD;
715 
716  BEGIN_MFSCRIPT;
717  include --path "${INCLUDE_PATH}" {config_base,config_png}.mfs;
718 
719  views name "views" views "diag";
720  defines name "shapes" define "shape"
721  strings "
722  cone
723  cuboid
724  ellipsoid
725  ellipsoid_s
726  tetrahedron
727  pyramid_q
728  torus_rp
729  torus_tp
730  torus_ep
731  star3d
732  ";
733  variables add_opts_combine "views shapes";
734  variables add_opts "--viewall --autocenter";
735 
736  include --path "${INCLUDE_PATH}" script_std.mfs;
737  END_MFSCRIPT;
738 END_SCOPE;
739 
740 BEGIN_SCOPE manifest;
741  BEGIN_OPENSCAD;
742  include <shapes3d.scad>;
743 
744  group = 1;
745  $fn = 72;
746 
747  if (group == 1)
748  st_cartesian_copy( grid=4, incr=60, center=true )
749  {
750  translate([0,0,-12.5]) cone( h=25, r=15, vr=2 );
751  cuboid( size=[25,40,20], vr=5, center=true );
752  ellipsoid( size=[40,25] );
753  ellipsoid_s( size=[60,15], a1=0, a2=270 );
754  tetrahedron( size=15, center=true );
755  pyramid_q( size=[35,40,25], center=true );
756  star3d(size=40, n=5, half=false);
757  }
758 
759  if (group == 2)
760  st_cartesian_copy( grid=4, incr=150, center=true )
761  {
762  torus_rp( size=[40,20], core=[35,20], r=40, l=[25,60], co=[0,2.5], vr=4, vrm=15, center=true );
763  torus_tp( size=40, core=30, r=60, co=[0,-4], vr=4, pa=90, ra=270, centroid=true );
764  torus_ep( size=[20,15], t=[2,4], r=60, a1=0, a2=180, pa=90, ra=270, co=[0,2] );
765  }
766  END_OPENSCAD;
767 
768  BEGIN_MFSCRIPT;
769  include --path "${INCLUDE_PATH}" {config_base,config_stl}.mfs;
770 
771  defines name "group" define "group" integers "1 2";
772  variables set_opts_combine "group";
773 
774  include --path "${INCLUDE_PATH}" script_std.mfs;
775  END_MFSCRIPT;
776 END_SCOPE;
777 */
778 
779 //----------------------------------------------------------------------------//
780 // end of file
781 //----------------------------------------------------------------------------//
function defined_or(v, d)
Return a defined or default value.
module ellipse_cs(size, core, t, a1=0, a2=0, co, cr=0)
A sector of an ellipse with a removed elliptical core.
Definition: shapes2d.scad:1239
module pyramid_q(size, center=false)
A pyramid with quadrilateral base.
Definition: shapes3d.scad:387
module star3d(size, n=5, half=false)
A three dimensional star.
Definition: shapes3d.scad:433
module ellipsoid(size)
An ellipsoid.
Definition: shapes3d.scad:253
module triangle_vl_c(vs, vc, co, cr=0, vr, vr1, vr2, centroid=false, incenter=false)
A general triangle specified by its sides with a removed triangular core.
Definition: shapes2d.scad:638
module cone(r, h, d, vr, vr1, vr2)
A cone.
Definition: shapes3d.scad:103
module rectangle_c(size, core, t, co, cr=0, vr, vr1, vr2, vrm=0, vrm1, vrm2, center=false)
A rectangle with a removed rectangular core.
Definition: shapes2d.scad:232
module ellipsoid_s(size, a1=0, a2=0)
A sector of an ellipsoid.
Definition: shapes3d.scad:285
function not_defined(v)
Test if a value is not defined.
eps
Epsilon, small distance to deal with overlaping shapes
Definition: constants.scad:47
module st_radial_copy(n, r=1, angle=true, move=false)
Distribute copies of a 2D or 3D shape equally about a z-axis radius.
Definition: transform.scad:322
function any_undefined(v)
Test if any element of a value is undefined.
module torus_ep(size, core, r, l, t, a1=0, a2=0, co, cr=0, pa=0, ra=360, m=255, profile=false)
An elliptical cross-sectional profile revolved about the z-axis.
Definition: shapes3d.scad:654
origin3d
The origin coordinates in 3-dimensional Euclidean space.
Definition: constants.scad:114
module st_rotate_extrude_elongate(r, l, pa=0, ra=360, m=255, profile=false)
Revolve the 2D shape about the z-axis with linear elongation.
Definition: transform.scad:139
module cuboid(size, vr, vrm=0, center=false)
A cuboid with edge, fillet, or chamfer corners.
Definition: shapes3d.scad:168
function edefined_or(v, i, d)
Return a defined vector element or default value.
function bitwise_is_equal(v, b, t=1)
Test if a base-two bit position of an integer value equals a test bit.
origin2d
The origin coordinates in 2-dimensional Euclidean space.
Definition: constants.scad:105
module torus_tp(size, core, r, l, co, cr=0, vr, vr1, vr2, pa=0, ra=360, m=255, centroid=false, incenter=false, profile=false,)
A triangular cross-sectional profile revolved about the z-axis.
Definition: shapes3d.scad:587
module triangle_lll(s1, s2, s3, vr, v1r, v2r, v3r, centroid=false, incenter=false)
A general triangle specified by its three side lengths.
Definition: shapes2d.scad:524
module torus_rp(size, core, r, l, t, co, cr=0, vr, vr1, vr2, vrm=0, vrm1, vrm2, pa=0, ra=360, m=255, center=false, profile=false)
A rectangular cross-sectional profile revolved about the z-axis.
Definition: shapes3d.scad:516
module tetrahedron(size, center=false)
A pyramid with trilateral base formed by four equilateral triangles.
Definition: shapes3d.scad:343