-
Notifications
You must be signed in to change notification settings - Fork 141
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
Discussion for 3d port #72
Comments
This library can make a 3d hull from a point cloud by using the outer most points. |
I learned from Fil's page how to use Delaunator on a sphere, and wrote up my notes and then made a planet generator. It's relatively easy if you only want to work on spheres, and I'm guessing a lot more work if you want it to work on arbitrary 3D. I made an animated gif to show what's going on: you place points on the sphere, "unwrap" it into a plane, run Delaunator, then "wrap" it back onto the sphere. The tricky part is that it leaves a little hole at the end (corresponding to the convex hull) and you have to add one extra polygon to fill that hole. |
wow what an amazing animation @redblobgames ! |
@redblobgames I've been admiring your work since like 2014 starting with https://www.redblobgames.com/grids/hexagons/ ! To be honest, while looking over 1843-planet-generation/sphere-mesh.js I got the idea to adapt delaunator. @Wayne5202 https://github.com/bjnortier/qhull seems like a perfect lib actually, considering I am interested (at the moment) in a sphere, a convex hull for the whole thing seems apropriate. Will definitely fallback to it this "experiment" does not work! As a little more context, at the moment I do want to work with a sphere, but I want options in the future to be able to do other shapes and 3D terrain/detail on those shapes for this project , and I want to find a good balance between making implementing something proper and getting stuff to work in a reasonable time so I do not lose motivation. |
Hello, Few things that caught me by surprise :
Also kept getting 4294967295 as an halfedges , did not debug the source but appeared only in the Will try later today some variations on params and to see maybe on flatter 3D points it works (but doubt it). 50 Fibonacci points |
Managed to find the perfect solution, and of course it was under my nose. Searching around, stumbled across this lib : https://github.com/mauriciopoppe/quickhull3d It is a convex hull algorithm not a delaunay one, but with some extra steps got a "planet" (sphere+noise elevation) to draw without missing the valleys, by running the ConvexHull (THREE.js implementation of that lib) on a sphere, and then adding the noise elevation to each points. Got 10k points on a perfect sphere to generate in 0.4s .... 10k in 0.7s , 100k in 5s and 500k in 25s. |
Hello, I am tempted to convert this library to work with 3D points and graphs.
I looked over
index.js
and managed to understand most of the parts.Main difficulties are with the hull aspects
hullNext
,hullPrev
,hullTri
,hullHash
, etc and a little with_legalize
, I imagine these 2 are kind of core functionality so should be much better understanded.Contents of
_hashKey
I also do not understand, but as it is a 2 value hash function, i can just use a slower Map and call it a day. This way i can ignorepseudoAngle
also.Most 2d functions can be implemented in 3d or have variants in robust-predicates :
dist
,inCircle
(use insphere),circumradius
,circumcenter
,orient2d
(use orient3d).I think most difficulties will rise from the increasing hull; in 2D, a new point results in a new triangle, but in 3D it could result in ~3 new triangles depending on neighbors.
Will start also to check delaunay-triangulate as it has a 3D delaunay implementation, but feel like delaunator is a better starting point since it is more used and maintained.
My motivation for doing this is mostly for procedurally generating points on a sphere (planet) , but feel that the way I am combining point generation, running d3-geo-voronoi, computing a graph with dijkstra and then drawing with THREE.js
I am wasting a lot of time with arrays and conversions.
I'm content with the possibility of this topic being too advanced for my skillset and just drop the port.
The text was updated successfully, but these errors were encountered: