Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properties of the triangulation #1

Closed
mdsumner opened this issue Mar 7, 2022 · 8 comments
Closed

properties of the triangulation #1

mdsumner opened this issue Mar 7, 2022 · 8 comments

Comments

@mdsumner
Copy link

mdsumner commented Mar 7, 2022

Do you have plans to expose the area/angle/steiner points control? I'm not familiar enough with the code here, so just to point to the properties in {RTriangle} triangulation() that allow specifying maximum area and angle and other properties of the triangulation. Is that of interest for you?

BTW, this is SO EXCELLENT!

Thank you so much, I've been trying to get this going with CGAL but failed - previously I've used {RTriangle} in my {anglr} package.

If of interest here's a spatial example, using {silicate} to break down a polygon layer to edges. That SC0 function also works on line objects, and sp package types as well.

sc <- silicate::SC0(sf::read_sf(system.file("gpkg/nc.gpkg", package = "sf", mustWork = TRUE))[1, ])

library(RCDT)
d <- delaunay(as.matrix(sc$vertex[c("x_", "y_")]), 
              as.matrix(do.call(rbind, sc$object$topology_)[c(".vx0", ".vx1")]))

plotDelaunay(d)

image

@stla
Copy link
Owner

stla commented Mar 7, 2022

Hello,

Thank you. The features you request are in the TODO list of the author of the CDT library: artem-ogre/CDT#7

@mdsumner
Copy link
Author

mdsumner commented Mar 7, 2022

ah, I see - thank you

keep an eye on thomasp35/euclid - that might eventually provide easy access to CGAL triangulations - but also see that it deps on {cgal4h}

I'll be interested to see how you are using this, and learning from how these libs get exposed in an R package ;)

@mdsumner
Copy link
Author

mdsumner commented Mar 8, 2022

hey and fwiw, you can convert a matrix or raster to a triangle mesh with {anglr} as.mesh3d, it was on CRAN but I haven't been able to get it updated

there's still {quadmesh} which does the same but for an old rgl format, it's much easier to code than I originally did - happy to show an example, just making a note here given your issue on the CDT repo

@mdsumner mdsumner closed this as completed Mar 8, 2022
@stla
Copy link
Owner

stla commented Mar 8, 2022

One can convert to a rgl mesh as follows:

......
del <- delaunay(vertices, edges)

#
mesh <- tmesh3d(
  vertices = t(cbind(vertices, 0)),
  indices = t(del[["triangles"]])
)
wire3d(mesh)

@mdsumner
Copy link
Author

mdsumner commented Mar 8, 2022

I'm aware, I was talking about your volcano example - you can do it directly without a triangulation function for an elevation matrix 🙏

@stla
Copy link
Owner

stla commented Mar 9, 2022

Ah ok, I misunderstood.

You might also be interested in my package RCGAL. It allows to do constrained 2D tessellations as well. Unfortunately, I can't submit it to CRAN because of a bug that R CMD CHECK doesn't digest.

@mdsumner
Copy link
Author

mdsumner commented Mar 9, 2022

oh cool, I had seen that but it dropped off the radar - I had played with hypertidy/laridae, and more recently hypertidy/delone but your efforts clearly much more than mine in that arena :)

I'm keeping an eye on dickoa/cgal4h and especially how it's used for thomasp/euclid ;)

(I've been trying to stir up interest in R spatial for years on this, but no one seems to understand the need - though it pops up in GEOS contexts and in rayshader etc where they use earclipping or Delaunay-modified ear clipping ...)

interested in any efforts! especially if we can consolidate things

@mdsumner
Copy link
Author

mdsumner commented Mar 9, 2022

all my stuff with Triangle is in hypertidy/anglr (but it needs an update for the recent new features for rgl::mesh3d ... and I just haven't gotten to it), but basically you can convert matrix/raster/polygons to meshes with that (some of it relies on hypertidy/silicate for decomposing to edges DEL0() ... or paths in the case of earclipping TRI0()) :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants