Description Usage Arguments Value See Also Examples
Given a surface approximation error matrix as computed with rtini_error()
,
extract a triangle mesh that approximates the original heightmap with error
less than or equal to a specified tolerance.
1 | rtini_extract(error, tol)
|
error |
a numeric matrix as produced by |
tol |
scalar positive numeric, the error tolerance |
a list of numeric matrices. Each column in a matrix corresponds to the "linearized" vertex coordinates of a triangle. See examples for how to convert to x-y coordinates. Each matrix corresponds to a different approximation layer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | err <- rtini_error(volcano)
mesh <- rtini_extract(err, tol=10)
## Convert linearized indices to x/y in [0,1]
tris <- rbind(do.call(cbind, mesh), NA)
plot.new()
polygon(
x=((tris - 1) %/% nrow(err)) / (ncol(err) - 1),
y=((tris - 1) %% nrow(err)) / (nrow(err) - 1),
col='grey90'
)
## One benefit of the linearized indices is that you can
## index directly into the height and error matrices. Here
## We use that to show the errors at every point that was not
## plotted versus volcano height.
plot(volcano[-unlist(mesh)], err[-unlist(mesh)])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.