# Tag: math

## fun with Math / pi

written in Vex / Houdini. inspired by Serjan Burlaks work

simple animation of Cos and Sin…. simple Vex program in Houdini and rendered with realtime engine Eevee (blender)

## sun flares simulation

first adept to simulate sun flares in houdin based on nbody model

## Sierpinski Gasket

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 );

}

}

## openCL tests in Houdini

a simple sin and PI function exereise.

## NNody simulation with openCL

an N-Body simulation which calculates a gravity field and corresponding velocity and acceleration contributions accumulated by each body in the system from every other body. Shows how to mitigate computation between all available devices including CPU and GPU devices, as well as a hybrid combination of both, using separate threads for each simulator.

the setup in Houdini : 120.000 stars simulated with the openCL wrangle in a Solver. the graphic card on my macbook RX420 GPU is about 25 faster then NBody in C/Vex on the I7 CPU

realtime nbody on my macbook with 40.000 stars