Gyula Kovacs

kulli

About Me

Expertise
Not Specified
Location
Germany
Website

Connect

Recent Forum Posts

Solving the Rubik's cube with Houdini and Python Jan. 15, 2018, 10:35 a.m.

Hey all,

I am working on a solution for the Rubik's cube. This is my first project with Python, but it's also a very nice and practical way of learning scripting and VEX.

The project is divided up into different steps:

  1. Create and describe the cube in Houdini.
  2. Import the cube into Python.
  3. Solve the cube in Python.
  4. Visualize the solution in Houdini

In this post, I want to give a brief overview how I am going to realize the steps above.

First of all, I needed to describe the cube in a simple way. Unfortunately, there are a lot of different attributes I need to store on points which reflect the cubies (those are the small cubes in the cube). The orientation, the position, the visible sites, the group (edge, mid, corner) etc.
To describe a cube, I am using points to which I am copying a cube at the end. I am only working on the points and mostly on their orientation and position: (This is the middle layer)
{-1,1,0} - {0,1,0} - {1,1,0}
{-1,0,0} - {0,0,0} - {1,0,0}
{-1,-1,0} - {0,-1,0} - {1,-1,0}
This seems obvious, but I needed to learn a lot about rotation and quaternions (also matrixes) to understand why and how I do the rotation for the 12 different turns.

The Turns:
There are 6 turns and 6 “counter-turns” (clockwise and counterclockwise), each of them are stored under a value 1-12. An array on a “helping point” (which doesn't belong to the cube) is storing the array. The solver checks for the current pos in the array, and if it matches the turn, the turn is going to be executed. At the end of the solver the pos is going to be deleted and a next, random number (turn) is replacing it.
This way, the solver can generate a random position for the cube just generating a random array of x numbers. BUT the same solver can also solve the cube with the correct array! Thats where I need Python

Thistlethwaite:
The first step is done, the cube is described matching my needs, and has a random position after running the solver. The next step is to import the current position of each point into Python, and running a script which will solve it
And there it comes, Dr. Thistlethwaite! His description of a solution for the cube is one which can be easily understood and the coding part for python is really not that hard. For more information, please visit this [www.jaapsch.net] site!

Back to Houdini:
After the final moves are found, a new array is going to describe the turns and the solver is going to execute them.


Where I am now?
I have done step 1 to describe the cube and I have understood all the math needed for the cube solver. I have an understanding of Python for being able to code the needed solver. Now, I need to store the point values from Houdini in a Python dictionary and to use it as a starting position for finding the solution. I am preferring a depth first search for the code, but it may vary depending on the results.

I will be back as soon as I have more to present!
Gyula

Laplace growth & Dielectric Breakdown Model with a fast simulation algorithm (Lightning creation) Jan. 15, 2018, 10:02 a.m.

Hey,

this is my (hopefully) last post regarding to this Project. I have successfully finished, as mentioned before, the Solver, and was also able to create a digital asset with different options:

1) Create a Grid (2D or 3D) which will work as the point cloud for the pattern to grow. The user also can plug in a given point cloud (Created on a geo surface e.g.), but those points shouldn't be placed randomly all over and should at least have an even distance to each other for being physically accurate (although I find results with at least a little randomness visually more powerful!)
2) Create Obstacles like boxes or spheres or other geometry. (The user simply needs to plug them in). Different values can be set for the rejection effect. This allows the user to optimize the simulation
3) Create a point as “aiming location”. This way, the user can add a point and set different values for the amount of attraction. Being able to do so will lead a lightning or other sim in the given direction.

This is it! A video about the creation can be found here [vimeo.com]. Another one showing a lightning bolt [vimeo.com].

There are a ton of other possibilities for the pattern. I am experimenting in a 3D growth behavior and a RBD object breaking apart according to the growth pattern (This is gonna be a nice one!).

Greetings,
Gyula

Mantra takes very long to start between frames Dec. 14, 2017, 7:09 a.m.

jsmack
Starts instantly for me.

What kind of licensing are you running? I am starting to believe, this has to do with the licensing type of my apprentice version, maybe also something to do with DNS, but I am going to do research about the problem now. I hope I can get it to run soon..