This little tutorial is an update on the Tutorial: “How to calculate intersections” posted on my blog August 17, 2012. It was a more complicated tutorial on “How to calculate intersections of 2 lines (splines) using Python and Cinema 4D”.
However, the part on how to check whether the intersection was on the line segment, was not fully correct. Here an update.
Here you can download the tutorial (PDF) and the c4d source file
This tutorial will explain how to create a ‘floating’ dialog using Python.
What you will learn:
– Register the plugin
– Define Tabs
– Define, read and write a Link field using the AddCustomGui function
– Define Separators
– Define, read and write a Combo Box
– Define and read File Input field using again the AddCustomGui function
Here you can download the zip with the tutorial (PDF), source and the plugin.
Everybody on the Plugin Cafe – Python Development, thanks for their help.
Here a script (R13) + tutorial explaining the Python code behind it, to posterize files.
For example, this icon was ‘posterized’.
The script asks for an input file and some input variables.
Then, based on given input factor, the average pixel color is calculated, an object (Cube or Sphere) is created and a material with the calculated average color created and assigned.
Example: The file is 512×512 and the input factor is 32.
This means that the picture will be ‘divide / posterized’ in 512 / 32 = 16 parts.
Each part is sampled and the average color is calculated. For each part an new objects will be created with the calculated average color.
In total 16*16 = 512 objects will be created.
Here you can download the source and an tutorial explaining the use and the Python code behind it.
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!