The three output tables of the shared contract.
Arguments
- m
a mesh from
lari_new()- erase
which triangles to return: "outer" (depth > 0, what Triangle's
-pkeeps), "holes" (odd depth), "hull" (all). With no segments every triangle is returned.
Value
a data frame; lari_tables() returns the three tables,
edge_sources and the report in a list, lari_depth() the depth column of the triangles
Details
vertices:
x,y, the attribute columns,origin("input", "crossing", "steiner") and the stable vertexidtriangles:
v0,v1,v2(1-based rows of the vertices table),depthanddepth_distinctsegments: constraint edges
v0,v1(rows of the vertices table), the inputsegmentid they came from (the lowest, when several coincide) andcount, the number of input segments covering the edgeedge_sources (mesh spec v0.2): one row per constraint edge and input segment covering it,
edge(row of the segments table),segment(the input segment id) andforward(TRUE when the input segment runs from the edge'sv0to itsv1), sorted byedgethensegment. Every covering segment has its own row, through crossings, coincident and collinear overlaps and refinement, socountis the number of rows per edge andsegmentthe lowest of them.
depth is the constraint layer: the number of constraint crossings on the
way in from outside the convex hull, counting an edge covered by k input
segments k times. depth_distinct is the same count but a doubled boundary
(an edge covered by several coincident segments) is crossed once, so it
ignores the count weighting. For nested rings odd is inside and even is a
hole; for a coverage it orders regions by distance from the boundary.
lari_tables() also returns a one-row report data frame recording the
provenance of the tables: backend ("laridae"), the laridae package and
cgal versions, the erase region, whether the mesh was refined, the
min_edge_length floor, and the last refinement's unrefined counts (bad,
short_edge, sharp_corner, outside, inserted, budget_hit,
stalled), all NA when the mesh has not been refined.
Row indices are only valid for one snapshot of the tables: use id to
follow vertices across edits.
Examples
m <- lari_new(c(0, 1, 1, 0, 0.25, 0.75, 0.75, 0.25),
c(0, 0, 1, 1, 0.25, 0.25, 0.75, 0.75),
1:8, c(2, 3, 4, 1, 6, 7, 8, 5))
table(lari_depth(m))
#>
#> 1 2
#> 8 2
lari_segments(m)
#> v0 v1 segment count
#> 1 1 4 4 1
#> 2 5 8 8 1
#> 3 3 4 3 1
#> 4 1 2 1 1
#> 5 7 8 7 1
#> 6 5 6 5 1
#> 7 2 3 2 1
#> 8 6 7 6 1
lari_edge_sources(m)
#> edge segment forward
#> 1 1 4 FALSE
#> 2 2 8 FALSE
#> 3 3 3 TRUE
#> 4 4 1 TRUE
#> 5 5 7 TRUE
#> 6 6 5 TRUE
#> 7 7 2 TRUE
#> 8 8 6 TRUE