After figuring out a way to calculate the triangle-count of the next iteration based on the current count it was possible to prevent program crashes due to vertex-/index-buffer overflows.
Another thing made possible is to "merge" the two generation algorithms, i.e. use one method for iteration x and the other for iteration x+1.
The "classic" Koch snowflake algorithm should look something like this:
- Start with a triangle (or a tetrahedron made of 4 triangles) and divide every edge in half.
- The 3 new points form 4 smaller triangles with half the size.
- The triangle in the middle is the base of a new tetrahedron.
- Do steps 1 and 3 for every triangle until desired complexity is reached (which is pretty fast).
"Classic" Koch Snowflake subdivision |
The variation I (and some others on the web) used nearly does the same, except the smaller tetrahedron is turned that the edges of the smaller base triangle are parallel with the bigger one:
Now I can combine the two different methods to create interesting new patterns. For example:
- Start with the initial tetrahedron, then use classic algorithm (C)
- Then use variation (V)
- Repeat alternations to create the pattern CVCVC
The pattern CVCVC |
The pattern VCVCV |
The pattern CCVVC |
The pattern VVCCV |
Many more patterns are possible, I was too lazy generating them all. Maybe on personal request...?