Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

How to compute 3D Delaunay Triangulation ? (with or without library)

$
0
0

Hi everyone,

I'm desperately and unsuccessfully trying to compute Delaunay triangulation from a 3D point cloud. It's a thing that many people have been trying to tackle for years (the same question has been asked over a dozen times on this forum: here, here, also here, here again...) but that has never found a proper solution.

To the best of my knowledge, there are 4 libraries capable of computing Delaunay triangulation:

  • Mesh by Lee Byron
  • iGeo by Satoru Sugihara
  • Hemesh (WBlut)
  • Toxiclibs by Karsten Schmidt

However:

  • Mesh only works in 2 dimensions (+ is flawed)
  • iGeo has not been ported yet to Processing 3
  • Voronoi & DelaunayTriangulation classes from Toxiclibs do not support 3D

It seems therefore the only solution lies in the Hemesh library.

GOAL

I would like to transform the colors of a painting into a 3D mesh via Delaunay triangulation. It's a relatively widespread technique that media artist Quayola (among others) has been brilliantly using for years.

PROBLEMS (hard to explain in english)

  • Instead of displaying a single 3D terrain (like in the pictures above) from a cloud of 3D points, the Hemesh library seems to compute multiple polyhedrons (like diamonds with cavities).
  • There is a threshold (triangulation.getAlphaTriangles(threshold)) to limit the amount of surrounding points to connect to, but that very threshold prevents from connecting to neighboring points that are far.

As a result, this painting from John William Waterhouse:

(some dude getting hit on at a pool party)

is tranformed to this:

(all the shapes are "closed" (P3 connected to P1) but it shouldn't be that way)

With a higher threshold:

(Between two layers of polyhedrons)

QUESTIONS

  • How can I avoid this behavior (if possible) ?
  • Do you know another library that could compute Delaunay triangulations in 3D space ?
  • Is there another way to achieve what I'm trying to do here (3D terrain from point cloud) ?

Important parts of the code (it's in Python but PLEASE DO NOT MOVE THIS QUESTION TO PYTHON MODE):

setup()

threshold = 35
render = WB_Render(this)
for p in points:
        new_points = WB_Point(p.x, p.y, p.z)
        list.append(new_points)
triangulation = WB_Triangulate.alphaTriangulate3D(list)
triangles = triangulation.getAlphaTriangles(threshold)

draw()

noStroke()
for i in range(0, len(triangles), 3):
    render.drawTriangle(liste[triangles[i]], liste[triangles[i+1]], liste[triangles[i+2]])

Thank you


Viewing all articles
Browse latest Browse all 2896

Trending Articles