Creating a 3-d model of a ternary phase diagram
How I Designed This
OpenJSCad code
var res = 64;
var side=100;
var p1 = [0,0];
var p2 = [side,0];
var p3 = [side/2,Math.sqrt(sideside3/4)];
var c1 = [0,0,0];
var c2 = [side,0,0];
var c3 = [p3[0],p3[1],0];
var stackOfTiles = new Array();
function main() {
for ( z=5; z<100; z+=7) {
stackOfTiles.push( CSG.cube({
corner1: [0, 0, z],
corner2: [100, 100, z+0.75]
}));
}
var s1o = CSG.sphere({
center: c1,
radius: 70.5,
resolution: res
});
var s2o = CSG.sphere({
center: c2,
radius: 60.5,
resolution: res
});
var s3o = CSG.sphere({
center: c3,
radius: 50.5,
resolution: res
});
var s1i = CSG.sphere({
center: c1,
radius: 70,
resolution: res
});
var s2i = CSG.sphere({
center: c2,
radius: 60,
resolution: res
});
var s3i = CSG.sphere({
center: c3,
radius: 50,
resolution: res
});
var triangle = polygon([c1,c2,c3]);
var prism = linear_extrude({height:100},triangle);
var outsideSpheres = s1o.union(s2o).union(s3o);
var insideSpheres = s1i.union(s2i).union(s3i);
var slices = outsideSpheres.intersect(union(stackOfTiles));
return union(slices,insideSpheres).intersect(prism);
}
Fuente del modelo
