// sym.cmd // For matching symmetric vertices wrt yz plane. define vertex attribute sym integer define vertex attribute miss real calc_sym := { foreach vertex vv do { dist := 1e30; symv := 0; foreach vertex vvv do { vdist := sqrt((vv.x+vvv.x)^2 + (vv.y-vvv.y)^2 + (vv.z-vvv.z)^2); if ( vdist < dist ) then { symv := vvv.id; dist := vdist; } }; vv.sym := symv; vv.miss := dist; } } shist := { histogram(vertex vv, sqrt((vv.x+vertex[vv.sym].x)^2 + (vv.y-vertex[vv.sym].y)^2 + (vv.z-vertex[vv.sym].z)^2) ) } makesym := { foreach vertex vv do { if vv.sym <= vv.id then { newx := (vv.x-vertex[vv.sym].x)/2; vv.x := newx; vertex[vv.sym].x := -newx; newy := (vv.y+vertex[vv.sym].y)/2; vv.y := newy; vertex[vv.sym].y := newy; newz := (vv.z+vertex[vv.sym].z)/2; vv.z := newz; vertex[vv.sym].z := newz; } } }