This tutorial shows how to calculate (in Python) 2D Voronoi using a brute method. Voronoi is often used to scatter or explode objects.

**Note:** In mathematics, a Voronoi diagram is a special kind of decomposition of a metric space, determined by distances to a specified family of objects (subsets) in the space.

In this tutorial you will learn:

– Get all polygons of an object.

– Calculate distance between an object and a polygon

(between a Null object and a point of the polygon).

– Add polygon, based on distance, to a selection.

Here you can download the source used in the tutorial.

**Note:** This is only a 2D solution. I’m still investigation a 3D solution. Any help is welcome!

For this kind of calculations you can use external python libraries,like meshpy.

but you need to patch c4d’s python.

sorry for my english

it would be great to be able to get a version of this that outputs splines–

for example, each color/selection, gets output to a 2D bezier or cubic closed spline

ML

You mean, you want the outline / the outer points of the various areas in a spline?

So I’ll need an algorithm to get the boundaries of a area.

I’ll give it some thoughts.

Of course you can use the polygon selection tags to select the polygons. Then use “Select Outline Selection” and then the “Edge to Spline command”. This will give you the spline you want!