omdl  v0.9.5
OpenSCAD Mechanical Design Library
Polytope

Polygon and polyhedron tools. More...

+ Collaboration diagram for Polytope:

Files

file  polytope.scad
 Polygon and polyhedron tools.
 

Functions

module polytope_number (c, f, e, vi=true, fi=true, ei=true, sp=false, ts, th, to, tr=0)
 Label the vertices, paths, and edges of a polytope. More...
 
module polytope_frame (c, f, e, vi=true, fi=true, ei=true, vc=1, fc=2, ec=0)
 Assemble a polytope skeletal frame using child objects. More...
 
module polytope_bounding_box (c, f, a)
 The 3d or 2d bounding box shape for a polytope. More...
 

Detailed Description

Polygon and polyhedron tools.

Requires:
include <omdl-base.scad>;
include <tools/align.scad>;
include <tools/polytope.scad>;

Function Documentation

◆ polytope_bounding_box()

module polytope_bounding_box ( ,
,
 
)

The 3d or 2d bounding box shape for a polytope.

Parameters
c<coords-3d | coords-2d> A list of 3d or 2d coordinate points.
f<<integer-list>-list> A list of faces (or paths) that enclose the shape where each face is a list of coordinate indexes.
a<decimal-list-1:3 | decimal> The box padding. A list of lengths to equally pad the box dimensions.

Generates: (1) the 3d box shape that completely encloses the defined 3d polyhedron with the box sides oriented parallel to the coordinate axes. Or: (2) the 2d box shape that exactly encloses the defined 2d polygon with the box sides oriented parallel to the coordinate axes. When f is not given, the listed order of the coordinates c establishes the path.

Bounding box example script

include <omdl-base.scad>;
include <database/geometry/polyhedra/archimedean.scad>;
include <tools/polytope.scad>;
id = "truncated_cuboctahedron";
c = table_get_value(tr, tc, id, "c");
f = table_get_value(tr, tc, id, "f");
polyhedron(c, f);
// end_include
dtr_polyhedra_archimedean
dtc_polyhedra_archimedean
function table_get_value(r, c, ri, ci)
Get the table cell value for a specified row and column identifier.
module polytope_bounding_box(c, f, a)
The 3d or 2d bounding box shape for a polytope.
Definition: polytope.scad:1029

Bounding box example diagram
topfrontdiag
expand topexpand frontexpand diag

See also
polytope_limits for warning about secondary Shapes.

Definition at line 1028 of file polytope.scad.

+ Here is the call graph for this function:

◆ polytope_frame()

module polytope_frame ( ,
,
,
vi  = true,
fi  = true,
ei  = true,
vc  = 1,
fc  = 2,
ec  = 0 
)

Assemble a polytope skeletal frame using child objects.

Parameters
c<coords-3d | coords-2d> A list of 3d or 2d coordinate points.
f<<integer-list>-list> A list of faces (or paths) that enclose the shape where each face is a list of coordinate indexes.
e<<integer-list-2>-list> A list of edges where each edge is a list of two coordinate indexes.
vi<index> Vertex index. An index sequence specification.
fi<index> Face index. An index sequence specification.
ei<index> Edge index. An index sequence specification.
vc<integer> Vertex child object index.
fc<integer> Face child object index.
ec<integer> Edge child object index.

Construct a skeletal frame for a given polytope. A 2d child object is linearly extruded along specified edges of the polytope to form the frame. Additional 3d child objects can be centered on specified vertices and/or the mean coordinates of specified faces.

To disable a child assignment to the vertices, faces, or edges, use an index that is less than zero or greater than the number of children. Parameter f is optional for polygons. When it is not given, the listed order of the coordinates c establishes the polygon path. When e is not specified, it is computed from f using polytope_faces2edges().

A. Framing example script

include <omdl-base.scad>;
include <tools/align.scad>;
include <units/coordinate.scad>;
include <database/geometry/polyhedra/cupolas.scad>;
include <tools/polytope.scad>;
id = "pentagonal_cupola";
c = table_get_value(tr, tc, id, "c");
f = table_get_value(tr, tc, id, "f");
v1 = coordinate_scale3d_csc(c, 100);
v2 = coordinate_scale3d_csc(c, 100, true);
repeat_grid(2, 225, center=true, $fn=36)
{
polytope_frame(v1, f) {circle(r=4); color("grey") sphere(r=6);}
polytope_frame(v2, f) {circle(r=4); color("grey") sphere(r=6);}
}
// end_include
dtc_polyhedra_cupolas
Definition: cupolas.scad:197
dtr_polyhedra_cupolas
Definition: cupolas.scad:212
module polytope_frame(c, f, e, vi=true, fi=true, ei=true, vc=1, fc=2, ec=0)
Assemble a polytope skeletal frame using child objects.
Definition: polytope.scad:789
module repeat_grid(g, i, c=1, center=false)
Distribute copies of 2d or 3d shapes about Cartesian grid.
Definition: repeat.scad:495
function coordinate(c, from=coordinate_unit_default, to=coordinate_unit_base)
Convert point from one coordinate system to another.
function coordinate_scale3d_csc(c, r, t=false)
Spherically scale a list of 3d cartesian coordinates.

A. Framing example diagram
toprightdiag
expand topexpand rightexpand diag

B. Framing example script

include <omdl-base.scad>;
include <tools/align.scad>;
include <units/coordinate.scad>;
include <database/geometry/polyhedra/archimedean.scad>;
include <tools/polytope.scad>;
id = "truncated_cuboctahedron";
c = table_get_value(tr, tc, id, "c");
f = table_get_value(tr, tc, id, "f");
polytope_frame(v, f, fi="even", $fn = 36)
{
circle(r=2);
color("grey") sphere(r=4);
color("red") star3d(20);
}
polytope_frame(v, f, fi="odd", fc=0, vc=-1, ec=-1)
color("blue") star3d(20);
%polyhedron(v, f);
// end_include
module star3d(size, n=5, half=false)
A three-dimensional star.
Definition: basic_3d.scad:813

B. Framing example diagram
diag
expand diag

Definition at line 788 of file polytope.scad.

+ Here is the call graph for this function:

◆ polytope_number()

module polytope_number ( ,
,
,
vi  = true,
fi  = true,
ei  = true,
sp  = false,
ts  ,
th  ,
to  ,
tr  = 0 
)

Label the vertices, paths, and edges of a polytope.

Parameters
c<coords-3d | coords-2d> A list of 3d or 2d coordinate points.
f<<integer-list>-list> A list of faces (or paths) that enclose the shape where each face is a list of coordinate indexes.
e<<integer-list-2>-list> A list of edges where each edge is a list of two coordinate indexes.
vi<index> Vertex index. An index sequence specification.
fi<index> Face index. An index sequence specification.
ei<index> Edge index. An index sequence specification.
sp<boolean> Show polyhedron shape.
ts<decimal> The text size override.
th<decimal> The text extrusion height override.
to<vector-3d | vector-2d> The text offset override.
tr<decimal-list-1:3 | decimal> The text rotation (in degrees).

Label the vertices, paths, and edges of a polytope. Parameter f is optional for polygons. When it is not given, the listed order of the coordinates c establishes the polygon path. When e is not specified, it is computed from f using polytope_faces2edges().

Numbering example script

include <omdl-base.scad>;
include <tools/align.scad>;
include <units/coordinate.scad>;
include <database/geometry/polyhedra/johnson.scad>;
include <tools/polytope.scad>;
id = "metagyrate_diminished_rhombicosidodecahedron";
c = table_get_value(tr, tc, id, "c");
f = table_get_value(tr, tc, id, "f");
polytope_number(v, f, sp=true, $fn = 36);
// end_include
dtr_polyhedra_johnson
Definition: johnson.scad:212
dtc_polyhedra_johnson
Definition: johnson.scad:197
module polytope_number(c, f, e, vi=true, fi=true, ei=true, sp=false, ts, th, to, tr=0)
Label the vertices, paths, and edges of a polytope.
Definition: polytope.scad:348

Numbering example diagram
topfrontdiag
expand topexpand frontexpand diag

Definition at line 347 of file polytope.scad.

+ Here is the call graph for this function: