omdl  v0.6.1
OpenSCAD Mechanical Design Library
Polytope

Polygon and polyhedron tools. More...

+ Collaboration diagram for Polytope:

Files

file  tools_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_bbox (c, f, a)
 The 3d or 2d bounding box shape for a polytope. More...
 

Detailed Description

Polygon and polyhedron tools.

Function Documentation

module polytope_bbox ( ,
,
 
)

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

Parameters
c<coords-3d|coords-2d> A list of 3d or 2d cartesian coordinates [[x, y (, z)], ...].
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.

Note
When f is not given, the listed order of the coordinates c establishes the path.
See also
polytope_limits for warning about secondary Shapes.

Definition at line 298 of file tools_polytope.scad.

+ Here is the call graph for this function:

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 index.
fc<integer> Face child index.
ec<integer> Edge child index.

This function constructs 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.

Example

include <tools/tools_polytope.scad>;
s = second(xy_plane_os) * 25;
p = linear_extrude_pp2pf(s, h=50);
{
circle(r=2);
color("grey") sphere(r=4);
color("blue") cube(4);
}
Note
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().

Definition at line 216 of file tools_polytope.scad.

+ Here is the call graph for this function:

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).
Note
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().

Definition at line 78 of file tools_polytope.scad.

+ Here is the call graph for this function: