Документация Engee

Polytopes

Страница в процессе перевода.

Abstract

Polytope{K,M,CRS}

We say that a geometry is a K-polytope when it is a collection of "flat" sides that constitute a K-dimensional subspace. They are called chain, polygon and polyhedron respectively for 1D (K=1), 2D (K=2) and 3D (K=3) subspaces. The parameter K is also known as the rank or parametric dimension of the polytope (https://en.wikipedia.org/wiki/Abstract_polytope).

The term polytope expresses a particular combinatorial structure. A polyhedron, for example, can be decomposed into faces. Each face can then be decomposed into edges, and edges into vertices. Some conventions act as a mapping between vertices and higher dimensional features (edges, faces, cells…​), removing the need to store all features.

Additionally, the following property must hold in order for a geometry to be considered a polytope: the boundary of a (K+1)-polytope is a collection of K-polytopes, which may have (K-1)-polytopes in common. See https://en.wikipedia.org/wiki/Polytope.

Notes

  • Type aliases are Chain, Polygon, Polyhedron.

Chain{M,CRS}

A chain is a 1-polytope, i.e. a polytope with parametric dimension 1. See https://en.wikipedia.org/wiki/Polygonal_chain.

See also Segment, Rope, Ring.

Polygon{M,CRS}

A polygon is a 2-polytope, i.e. a polytope with parametric dimension 2.

See also Ngon and PolyArea.

Polyhedron{M,CRS}

A polyhedron is a 3-polytope, i.e. a polytope with parametric dimension 3.

See also Tetrahedron, Hexahedron and Pyramid.

Concrete

Segment

Segment(p1, p2)

An oriented line segment with end points p1, p2. The segment can be called as s(t) with t between 0 and 1 to interpolate linearly between its endpoints.

See also Rope, Ring, Line.

Segment((0., 0.), (1.,1.)) |> viz
x+Q2yKcf4wJvQAAAABJRU5ErkJggg==

Rope

Rope(p1, p2, ..., pn)

An open polygonal chain from a sequence of points p1, p2, …​, pn.

See also Chain and Ring.

Rope((0.,0.), (1.,0.5), (1.,1.), (2.,0.)) |> viz
gNk7jr0cEQgAAAAAwKN4yCgAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwKAIhAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwKAIhAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwKAIhAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwKAIhAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIP6L7rhcRiWjUGJAAAAAElFTkSuQmCC

Ring

Ring(p1, p2, ..., pn)

A closed polygonal chain from a sequence of points p1, p2, …​, pn.

See also Chain and Rope.

Ring((0.,0.), (1.,0.5), (1.,1.), (2.,0.)) |> viz
9WrV63fcKCi9evXV+6QlZlevjYzgFs+jX8aORkMBkt+WdDEpUuXNm3aFBcXl52d3bp165CQkHnz5nXo0KHCYdeuXVPPmfTt23fMmDEV9mZkZGzcuPHYsWOpqamenp59+vQJCwsbNGiQjb4DUA3Le+amTZsyMzNFZPHixRUSYFZW1tq1a8+dO5eSkuLs7BwUFNS7d++wsLCmTZva6GsAZqWkpOzatUtEZs6cWeWr6mJiYs6dOyciEydOrPwWDQZwOLhdu3alpKR07tx56tSplffm5+evWrVKRLy9vefNm1dh79WrV9evX5+UlHT79u2WLVsGBwcPGjRo+vTp6rY9wMZOnDhx6tSpGg8LDAycOHGi+tn8AG7hNP5pRCAEAAAAAJ3iLaMAAAAAoFMEQgAAAADQKQIhAAAAAOgUgRAAAAAAdIpACAAAAAA6RSAEAAAAAJ0iEAIAAACAThEIAQAAAECnCIQAAAAAoFMEQgAAAADQKQIhAAAAAOgUgRAAAAAAdIpACAAAAAA6RSAEAAAAAJ0iEAIAAACAThEIAQAAAECnCIQAAAAAoFMEQgAAAADQKQIhAAAAAOgUgRAAAAAAdIpACAAAAAA6RSAEAAAAAJ0iEAIAAACAThEIAQAAAECnCIQAAAAAoFMEQgAAAADQKQIhAAAAAOgUgRAAAAAAdIpACAAAAAA6RSAEAAAAAJ0iEAIAAACAThEIAQAAAECnCIQAAAAAoFMEQgAAAADQqf8CvIFyccpeX70AAAAASUVORK5CYII=

Ngon

Ngon(p₁, p₂, ..., pₙ)

A N-gon is a polygon with N ≥ 3 vertices p₁, p₂, …​, pₙ oriented counter-clockwise (CCW). In this case the number of vertices is fixed and known at compile time. Examples of N-gon are Triangle (N=3), Quadrangle (N=4), Pentagon (N=5), etc.

Notes

  • Although the number of vertices N is known at compile time, we use abstract vectors to store the list of vertices. This design allows constructing N-gon from views of global vectors without expensive memory allocations.

  • Type aliases are Triangle, Quadrangle, Pentagon, Hexagon, Heptagon, Octagon, Nonagon, Decagon.

Triangle((0.,0.), (1.,0.), (0.,1.)) |> viz
wfTfpKnUo6WVwAAAABJRU5ErkJggg==

PolyArea

PolyArea(outer)
PolyArea([outer, inner₁, inner₂, ..., innerₖ])

A polygonal area with outer ring, and optional inner rings inner₁, inner₂, …​, innerₖ.

Rings can be a vector of Point or a vector of tuples with coordinates for convenience, in which case the first point should not be repeated at the end of the vector.

outer = [(0, 0), (1, 0), (1, 1), (0, 1)]
hole1 = [(0.2, 0.2), (0.2, 0.4), (0.4, 0.4), (0.4, 0.2)]
hole2 = [(0.6, 0.2), (0.6, 0.4), (0.8, 0.4), (0.8, 0.2)]
poly  = PolyArea([outer, hole1, hole2]) |> viz
q+fPnyf787Nmzaxdcu4FHtzzGPzjx5eXlfV8DAAAA98BDZQAAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAIlCAEAAAL1C+dqOWpv4kN7AAAAAElFTkSuQmCC

Tetrahedron

Tetrahedron(p1, p2, p3, p4)

A tetrahedron with points p1, p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