playing with the Sierpinski Gasket in houdini, coding exereise. Houdini Vex is very fast and its easy convert it from my c++ code. the fun Part, i get openGL feedback in realtime with need to code in OpenGL.

float resX = 600;

float resY = 600;

float deltaD = 0.5;

int numVert = 3;

float pi = 3.1415922653;

float rotOffset = pi / 6.0;

vector pos= {0,0,0};

float cx = (resX/2.0)*cos((2*pi/numVert) + rotOffset) + (resX /2);

float cy = (resY/2.0)*sin((2*pi/numVert) + rotOffset) + (resY /2);

int iter = chf(“iteration”);

for(int i=0; i<(iter+15); i++) { int num = int(((rand(i)*32767) % numVert) +1); float xVert = (resX/2) * cos((2*pi*num / numVert) + rotOffset) + (resX/2); float yVert = (resY/2) * sin((2*pi*num / numVert) + rotOffset) + (resY/2); cx += deltaD * (xVert – cx); cy += deltaD * (yVert – cy); if(i>15) {

pos.x = cx;

pos.y = cy;

addpoint( 0, pos );

}

}