(Question already posted in StackExchange - https://stackoverflow.com/questions/50304079/marching-cubes-for-quadrics-three-js)

I have tried to implement an applet showing the distinct types of space quadrics with the Marching Cubes library of three.js to render implicit surfaces. The shapes that appear though are not right and I guess I am not implementing the properties of `THREE.MarchingCubes`

as needed. The core of the applet has the following code

```
quadricData = {
a11: 1,
a22: 1,
a33: 1,
a12: 0,
a13: 0,
a23: 0,
a1: 0,
a2: 0,
a3: 0,
a: -1
};
quadValue = function (data, x, y, z) {
return data.a11*x*x+
data.a22*y*y+
data.a33*z*z+
data.a12*2*x*y+
data.a13*2*x*z+
data.a23*2*y*z+
data.a1*x+
data.a2*y+
data.a3*z+
data.a;
}
var res = 50;
var material = new THREE.MeshPhongMaterial( {
color: '#1565C0', // blue 800
transparent: true,
opacity: 0.8,
side: THREE.DoubleSide,
flatShading: true
} );
quadric = new THREE.MarchingCubes( res, material );
quadric.isolation = 0;
for ( var k = 0 ; k < res ; k++ ) {
for ( var j = 0 ; j < res ; j++ ) {
for ( var i = 0 ; i < res ; i++ ) {
var x = 8*(i-res/2)/res;
var y = 8*(j-res/2)/res;
var z = 8*(k-res/2)/res;
quadric.field[ i + j*res + k*res*res ] = quadValue(quadricData,x,y,z);
}
}
}
```

but the full code may be inspected here. I suppose that the `field`

attribute has to be filled with the values of a function, but perhaps this is not the correct way to proceed. Strange effects appear, for instance, when making `a11`

large, which expands the ellipsoid instead of shrinking it; the ‘marching cubes grid’ seems also to expand, which is sort of funny. Many other configurations do not match the expected result. Which is the right way to use `THREE.MarchingCubes`

?