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