Créer un modèle 3D d'un diagramme de phase ternaire.
Comment j'ai conçu ceci.
Le code d'OpenJSCad.
var res = 64 ;
var side=100 ;
var p1 = [0,0];
var p2 = [side,0];
var p3 = [side/2,Math.sqrt(side)]côté[3/4] ;
var c1 = [0,0,0];
var c2 = [side,0,0];
var c3 = [p3[0],p3[1],0];
var stackOfTiles = new Array();
fonction main() {
pour (z=5 ; z<100 ; z+=7) {
stackOfTiles.push( CSG.cube({
coin 1 : [0, 0, z],
coin2 : [100, 100, z+0.75]
)));
)
var s1o = CSG.sphere({
centre : c1,
rayon : 70,5,
résolution : res
});
var s2o = CSG.sphere({
centre : c2,
rayon : 60,5,
résolution : res
});
var s3o = CSG.sphere({
centre : c3,
rayon : 50,5,
résolution : res
});
var s1i = CSG.sphere({
centre : c1,
rayon : 70,
résolution : res
});
var s2i = CSG.sphere({
centre : c2,
rayon : 60,
résolution : res
});
var s3i = CSG.sphere({
centre : c3,
rayon : 50,
résolution : 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));
retournez l'union (des tranches, des sphères intérieures). intersectez-la avec le prisme ;
)
Источник модели
