round vertices coords
for omsk models
by shrpne
HTML
<textarea data-src></textarea>
<textarea data-out></textarea>
<button data-button>go</button>
JavaScript
function process() {
var vertices = JSON.parse(document.querySelector('[data-src]').value);
console.log(vertices)
vertices.forEach(function(vertice) {
vertice.x = Math.round(vertice.x * 100) / 100;
vertice.y = Math.round(vertice.y * 100) / 100;
vertice.z = Math.round(vertice.z * 100) / 100;
});
document.querySelector('[data-out]').value = JSON.stringify(vertices)
}
document.querySelector('[data-button]').addEventListener('click', process)