73 for (ip = [
for (fi = f)
for (ai =
sequence_ns(fi, n=2, s=1, w=
true)) ai])
114 : is_undef(i) ? undef
188 ? [
for (j = ax) [
for (m = f)
for (i=[0 : len(m)-1]) c[m[i]][j]]]
189 : [
for (j = ax) [
for (i = c) i[j]]],
191 b = [
for (j = ax) [min(pm[j]), max(pm[j])] + [-ap[j]/2, +ap[j]/2]]
194 (s == true) ? b[j][1] - b[j][0] : [b[j][0], b[j][1]]
235 d = len([for (i=b) if (i != [undef, undef]) i])
238 [ [for (x=b[0], y=b[1], z=b[2]) [x, y, z]],
239 [[0,2,3,1], [4,0,1,5], [6,4,5,7], [2,6,7,3], [0,4,6,2], [3,7,5,1]] ]
240 : [ [for (x=b[0], y=b[1]) [x, y]],
267 for (ci = [1 : len(fi)-2]) [fi[0], fi[ci], fi[ci+1]]
307 for (fi = f) let (fn = len(fi))
329 ) = [for (fi = [0:len(f)-1]) if (
exists(i, f[fi])) fi];
354 for (fi = [0:len(f)-1])
463 pc = [for (i = [0:2]) let (p = c[ci[i]]) (len(p) == 3) ? p : [p[0], p[1], 0]]
465 cross(pc[0]-pc[1], pc[2]-pc[1]) * ((cw == true) ? 1 : -1);
506 pc = [for (i = ci) c[i]]
567 ) = [for (fi=f) len(fi)];
590 for (i=[0 : len(f)-1])
593 n1 =
cross_ll([c[f[i][0]], c[f[i][1]]], [c[f[i][0]], c[f[i][2]]]),
594 af = [for (v=f[i]) for (j=[0 : len(f)-1]) if (j != i &&
exists(v, f[j])) j]
599 n2 =
cross_ll([c[f[u][0]], c[f[u][1]]], [c[f[u][0]], c[f[u][2]]])
643 for (k=[for (j=f) for (i=
sequence_ns(j, n=3, s=1, w=true)) i])
644 angle_ll([c[k[0]], c[k[1]]], [c[k[1]], c[k[2]]])
689 ((len(ul) == 1) && (len(ua) == 1));
function angle_ll(l1, l2, s=true)
Compute the angle between two lines or vectors in a 3d or 2d-space.
function cross_ll(l1, l2)
Compute the cross product of two lines or vectors in a 3d or 2d-space.
function unit_l(l)
Compute the normalized unit vector of a line or vector.
function distance_pp(p1, p2)
Compute the distance between two points.
function unique(v)
Return a list of the unique elements of an iterable value.
function defined_e_or(v, i, d)
Return an element of an iterable when it exists or a default value otherwise.
function exists(mv, v, s=true, i)
Check for the existence of a match value in an iterable value.
function second(v)
Return the second element of an iterable value.
function first(v)
Return the first element of an iterable value.
function sequence_ns(v, n=1, s=1, w=false)
Return a list of all n-element sequential-subsets of an iterable value.
function all_len(v, l, c=0)
Test if all elements of an iterable value are iterable with a fixed length.
function mean(v)
Compute the mean/average of a list of numbers.
function consts(l, v, u=false)
Create a list of constant or incrementing elements.
function round_s(v, d=6)
Round a list of numbers to a fixed number of significant figures.
function index_c(i, l, f=0)
Return a circular index position.
function defined_or(v, d)
Return given value, if defined, or a secondary value, if primary is not defined.
function is_scalar(v)
Test if a value is a single non-iterable value.
function is_defined(v)
Test if a value is defined.
function is_integer(v)
Test if a value is an integer.
function is_range(v)
Test if a value is a range definition.
function polytope_edge_angles(c, f)
List the adjacent edge angles for each polytope vertex.
function polytope_edge_adjacent_faces(f, e, i)
List the adjacent face indexes for a polytope edge.
function polytope_face_mean_normal(c, f, i, l, cw=true)
Get the mean coordinate and normal vector of a polytope face.
function polytope_edge_normal(c, f, e, i)
Get a normal vector for a polytope edge.
function polytope_face_angles(c, f)
List the angles between all adjacent faces of a polyhedron.
function polytope_faces2edges(f)
List the edge coordinate index pairs of a polytope.
function polytope_vertex_adjacent_vertices(f, i)
List the adjacent vertices for a given polytope vertex.
function polytope_vertex_adjacent_faces(f, i)
List the adjacent face indexes for a polytope vertex.
function polytope_face_normal(c, f, i, l, cw=true)
Get the normal vector of a polytope face.
function polytope_face_vertex_counts(f)
List the vertex counts for all polytope faces.
function polytope_line(c, f, e, i, l, r=false)
Get a line from an edge or any two vetices of a polytope.
function polytope_face_mean(c, f, i, l)
Get the mean coordinate of all vertices of a polytope face.
function polytope_faces_are_regular(c, f, e, d=6)
Test if the faces of a polytope are all regular.
function polytope_bounding_box_pf(c, f, a)
Generate a bounding box polytope for another polytope in 3d or 2d.
function polytope_limits(c, f, a, d, s=true)
Determine the bounding limits of a polytope.
function polytope_face_plane(c, f, i, l, cw=true)
Get a plane for a polytope face.
function polytope_vertex_normal(c, f, i)
Get a normal vector for a polytope vertex.
function polytope_edge_lengths(c, e)
List the edge lengths of a polytope.
function polytope_ft_triangulate(f)
Triangulate the faces of a convex polytope using fan triangulation.