mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 13:37:58 +01:00
simplify calculating center
This commit is contained in:
parent
72c7c91b27
commit
5f1a7e3e74
@ -15,10 +15,8 @@ export function createScene(canvas, props, state) {
|
|||||||
|
|
||||||
// center geometry
|
// center geometry
|
||||||
geometry.computeBoundingBox();
|
geometry.computeBoundingBox();
|
||||||
const centerX = (geometry.boundingBox.max.x + geometry.boundingBox.min.x) / 2;
|
const center = geometry.boundingBox.getCenter();
|
||||||
const centerY = (geometry.boundingBox.max.y + geometry.boundingBox.min.y) / 2;
|
geometry.applyMatrix(new THREE.Matrix4().makeTranslation(-center.x, -center.y, -center.z));
|
||||||
const centerZ = (geometry.boundingBox.max.z + geometry.boundingBox.min.z) / 2;
|
|
||||||
geometry.applyMatrix(new THREE.Matrix4().makeTranslation(-centerX, -centerY, -centerZ));
|
|
||||||
|
|
||||||
const renderer = new THREE.WebGLRenderer({ canvas, alpha: true, antialias: true });
|
const renderer = new THREE.WebGLRenderer({ canvas, alpha: true, antialias: true });
|
||||||
renderer.setClearColor(0xffffff, 0);
|
renderer.setClearColor(0xffffff, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user