# ofxMarchingCubes for points

Hi, I am trying to adapt the ofxMarchingCubes add-on to work with my particle-based fluid simulation. To render some spheres, the example is as follows:

``````		//SPHERES
ofVec3f step = ofVec3f(3./mc.resX, 1.5/mc.resY, 3./mc.resZ) * PI;
for(int i=0; i<mc.resX; i++){
for(int j=0; j<mc.resY; j++){
for(int k=0; k<mc.resZ; k++){;
float val = sin(float(i)*step.x) * sin(float(j+elapsedTime)*step.y) * sin(float(k+elapsedTime)*step.z);
val *= val;
mc.setIsoValue( i, j, k, val );
}
}
}
``````

How can I adapt this to work with many points? I have made several attempts but I think they are way off. Does anyone know how to do it? Obviously you start by looping over all the particles, and use the coordinates of each particle, but I’m pretty lost after that. Thanks. Here was my attempt, which gives me a wall and runs very slowly:

``````    for(int p = 0; p < particleSystem.size(); p++) {
BinnedParticle& cur = particleSystem[p];
particleSystem.computeDensity3D(cur, particleNeighborhood, particleRepulsion);
particleSystem.computePressure(cur, particleNeighborhood, particleRepulsion);
particleSystem.updateForces3D(cur, particleNeighborhood, particleRepulsion);
ofVec3f step = vec3 (particleSystem[p].x/mc.resX, particleSystem[p].y/mc.resY, particleSystem[p].z/mc.resZ) ;
//mc.setIsoValue( step.x, step.y, step.z, .6);
for(int i=0; i<mc.resX; i++){
for(int j=0; j<mc.resY; j++){
for(int k=0; k<mc.resZ; k++){
float val = (float(i)*step.x) * (float(j)*step.y) * (float(k)*step.z);                            mc.setIsoValue( i, j, k, val );
}
}
}
}
mc.update();
``````

hey sorry for offtopic this, but how did you solved the error?:
`/Users/u/Documents/of_v0.10.1_osx_release/addons/ofxMarchingCubes/example_ofxMarchingCubes/src/ofApp.cpp:89:101: No member named 'getInverse' in 'glm::tmat4x4<float, glm::precision::packed_highp>'`

``````//draw the mesh
if (ofIsGLProgrammableRenderer()) {
ofMatrix4x4 normalMatrix = ofMatrix4x4::getTransposedOf((ofGetCurrentMatrix(OF_MATRIX_MODELVIEW)).getInverse());
``````if (ofIsGLProgrammableRenderer())