10

I would like to implement a Maya plugin (this question is independent from Maya) to create 3D Voronoi patterns, Something like

enter image description here

I just know that I have to start from point sampling (I implemented the adaptive poisson sampling algorithm described in this paper).

I thought that, from those points, I should create the 3D wire of the mesh applying Voronoi (I tried to use (Python) scipy.spatial.Voronoi but the result was something different from what I expected).

I am missing something? Can anyone suggest the proper pipeline and algorithms I have to implement to create such patterns?

[EDIT] Here are a few example of what I get handling the result i get from scipy.spatial.Voronoi like this (as suggested here):

vor = Voronoi(points)
for vpair in vor.ridge_vertices:
    for i in range(len(vpair) - 1):
        if all(x >= 0 for x in vpair):
            v0 = vor.vertices[vpair[i]]
            v1 = vor.vertices[vpair[i+1]]
            create_line(v0.tolist(), v1.tolist())

The grey vertices are the sampled points (the original shape was a simple sphere): enter image description here

Here is a more complex shape (an arm) enter image description here

Jiloc
  • 201
  • 1
  • 5
  • Thank you for the reply. I am going to replicate what I did and post a screen as suggested. Anyway the final intent of this question isn't to debug my code, but to understand if what I am doing is right or there are others steps that I am missing in between! – Jiloc Oct 20 '15 at 15:55
  • added examples as suggested! – Jiloc Oct 21 '15 at 11:38
  • The points from the poisson sampling are right. The algorithm that generates them is fully unit tested and the ones you see in the screens are spheres with the center in the sampled point which i programmatically created before calling Voronoi(points)! I am worried that I am not following the proper path or I am handling the Voronoi result in a wrong way – Jiloc Oct 21 '15 at 20:10
  • The images you show have done the voronoi on the 2d function. – joojaa Oct 22 '15 at 03:57
  • @joojaa From the example images I expected that the Voronoi cell edges on the 2D surface were what was required (to give a collection of line segments connecting points on the sphere surface, rather than the collection of plane sections that would be given in 3D). However, [scipy.spatial.Voronoi](http://scipy.github.io/devdocs/generated/scipy.spatial.Voronoi.html) seems to be designed for N dimensional spaces rather than surfaces embedded in them. I can't immediately see how it would be used for 3D points constrained to a 2D surface. – trichoplax is on Codidact now Oct 22 '15 at 10:07
  • Is not a problem to me if I have to change library or to write my own implementation. If you can suggest any source I need to look at I will be happy to do it! – Jiloc Oct 22 '15 at 10:20
  • I'm guessing you would need to implement a distance function for two points on a surface. On the sphere you can get away with just using the 3D Euclidean distance but for arbitrary shapes you'll need something more specific otherwise points that are near to each other in 3D due to folds in the surface will appear nearer to each other than to points between them. – trichoplax is on Codidact now Oct 22 '15 at 14:29
  • Do you mean to sample points? I am using isotopic distance to accomplish this. Anyway as you see, my problem is with the Voronoi computation, not the initial sampling procedure, but maybe I didn't understand what you were saying! – Jiloc Oct 22 '15 at 14:36
  • No I meant the Voronoi step - converting cell centres (the Poisson sampled points) into cell edges. This also requires a length calculation in order to determine which line is equidistant from a given two points. – trichoplax is on Codidact now Oct 22 '15 at 20:37
  • These articles look relevant to what you are trying to achieve: http://meshlabstuff.blogspot.com/2009/03/creating-voronoi-sphere.html http://meshlabstuff.blogspot.com/2009/04/creating-voronoi-sphere-2.html – Julien Guertault Oct 26 '15 at 03:19

1 Answers1

1

http://www.cs.sandia.gov/~samitch/papers/vor_final.pdf There isn't the computer algorithm in any programming languague, but u should be able to replicate it easily with some Plane Reflections and the algorithms from the above link.

  • Welcome to ComputerGraphics.SE! It's normally a good idea to make answers on Stack Exchange self contained (e.g. in case links go down and also in general so that people don't have to follow links to be able to tell if an answer is useful to them). You might want to improve your answer by including a short summary of the contents of the paper. – Martin Ender Oct 13 '16 at 21:22