DISINTEGRATING CUBE
The algorithm has the two main components of a cube assembled from smaller cubes and an attraction point
influencing the cubes geometry.
The amount of cubes that the larger cube is assembled from, as well as their size, can be controlled by a slider.
The attraction point has a maximum distance from which it influences the cubes. Inside of that distance,
the cubes are pulled towards the attraction point, as well as scaled down. The closer the cubes are to the attraction point,
the farther towards the attraction point they are translated relative to their previous position and the smaller they get.
With an integrated GUI the attraction points coordinates, aswell as the count and size of the cubes making up the bigger cube can be controlled.
The algorithms code is mainly split in three Parts: in the first part general base parameters are established, aswell as a dictionary which also contains the user input from the GUI.
The main part starts with three nested for-loops which create an three dimesional array of vectors. For each of the vectors a box is generated.
By calculating the distance between each individual cube and the attractor point, each cube can be translated towards the attractor point by an individual distance and in an individual direction.
Depending on the distance to the attractor point the cubes are also scaled down. Because the cubes have to be generated again for this, they are translated to their allocated position another time.
After that, the geometry can be visualized. The last part of the Code creates a feedback loop to constantly check wheter the geometry has been updated by GUI input, and updating the geometry accordingly.
Klick and drag on the screen to turn or move the geometry!
Use the sliders to controll the amount of generated cubes, their size as well as the x,y and z coordinates of the attractor point.