Three.js + Delaunator

Hi, community!

Recently, I’ve found a library for triangulation - Delaunator - and tried to combine it with Three.js.

The result is here:


I couldn’t resist and had to add it to the collection immediately.


1 Like

Thanks, Klaus :handshake:
It’s really helpful to have those examples in one place :+1:

It’s really helpful to have those examples in one place :+1:

@prisoner849 there’s at least a couple of your examples that would work well in the official examples list. Have you considered submitting them on GitHub?

Speechless :open_mouth:

I’m not sure I fully understand how it works, this part specifically

> // triangulate x, z
> var indexDelaunay = Delaunator.from(
> => {
>     return [v.x, v.z];
>   })
> );

Why doesn’t it take the y coordinate into account? I tried using this to triangulate a cube but I can either get the top or a side face depending on whether in the code above I write [v.x, v.z] or [v.x, v.y]

I tried making the bottom part of the cube larger and I see the bottom points, but not the bottom triangles. So this Delaunator can only triangulate an open surface seen from a certain direction? Isn’t it possible to use this to triangulate a closed surface?

@Atlas Triangulation performs on a set of 2D points.

Isn’t there any algorithm to triangulate 3d shapes? I’d have to project my model onto a 2d plane to do the triangulation and then wrap it back in some way?

@Atlas Maybe to use ConvexGeometry.

The shape I want to recreate isn’t convex though, I tried and the convex shape covers too much volume. Having to triangulate the vertex array seems almost overkill because I already have a mesh with its triangles, but I then take the coordinates of the vertices, add some values and recreate a new geometry, but I only have an array of numbers at that point so I have to recreate the triangles from 0. I could maybe copy the original mesh and move its vertices while already being in a geometry rather than extracting the coordinates and then using them to create a new geometry, but this is probably off topic

Nice work. Just what I have been looking for a new project looking at terrain modeling, analysis and design.
@prisoner849 are you available for hire or can you recommend someone with interest/ experience in this area?

of course… prisoner849!!(paul) Great work! just what i needed (and of course i must say hi to hofk both of you have suppplied me, through out the web with i think perhaps my entire working knowledge of three js, beyond the .org examples of course.

but if you dont mind me asking… do you think, maybe we could …say combine…

three.js +
delaunay triangulation+
jsfeat (for opencv tracking… )

for the beginning of a very efficient three.js equivalent to some ARcore functions like spatial mapping?

(((IF… we could port this c++ Fast Lightweight Mesh Estimation GitHub - robustrobotics/flame: FLaME: Fast Lightweight Mesh Estimation
to web assembly (which lol, im having a very hard time with currently. )))
then I think we could most definitely agree and say yes?

(who knows c++ and web assembly??)

1 Like