From e80e22026cefdcc7ccb1db6ba8e7f791b85b4ca6 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Sun, 16 Jan 2022 22:58:37 -0500 Subject: [PATCH] auto-scale tiny obj imports --- src/mesh/group.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mesh/group.js b/src/mesh/group.js index 00ff7234..5e4fbb99 100644 --- a/src/mesh/group.js +++ b/src/mesh/group.js @@ -97,7 +97,15 @@ mesh.group = class MeshGroup extends mesh.object { } promote() { - return this.centerModels().centerXY().floor(); + this.centerModels(); + let { dim } = this.bounds; + let { x, y, z } = dim; + let max = Math.max(x, y, z); + if (max < 2) { + mesh.api.log.emit(`auto-scaling import from ${max.round(5)}`); + this.scale(1000, 1000, 1000); + } + return this.centerXY().floor(); } // center objects to group bounds