mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 13:37:58 +01:00
beter type checking
This commit is contained in:
parent
bacca4099c
commit
2b783e2889
@ -3,7 +3,7 @@ import slice from './sliceActions/slice.js';
|
|||||||
import SlicerWorker from './slicer.worker.js';
|
import SlicerWorker from './slicer.worker.js';
|
||||||
|
|
||||||
export function sliceMesh(settings, mesh, sync = false, onProgress) {
|
export function sliceMesh(settings, mesh, sync = false, onProgress) {
|
||||||
if (typeof mesh === 'undefined' || !mesh.isMesh) {
|
if (!mesh || !mesh.isMesh) {
|
||||||
throw new Error('Provided mesh is not intance of THREE.Mesh');
|
throw new Error('Provided mesh is not intance of THREE.Mesh');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ export function sliceMesh(settings, mesh, sync = false, onProgress) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function sliceGeometry(settings, geometry, matrix, sync = false, onProgress) {
|
export function sliceGeometry(settings, geometry, matrix, sync = false, onProgress) {
|
||||||
if (typeof geometry === 'undefined') {
|
if (!geometry) {
|
||||||
throw new Error('Missing required geometry argument');
|
throw new Error('Missing required geometry argument');
|
||||||
} else if (geometry.isBufferGeometry) {
|
} else if (geometry.isBufferGeometry) {
|
||||||
geometry = new THREE.Geometry().fromBufferGeometry(geometry);
|
geometry = new THREE.Geometry().fromBufferGeometry(geometry);
|
||||||
@ -27,7 +27,7 @@ export function sliceGeometry(settings, geometry, matrix, sync = false, onProgre
|
|||||||
throw new Error('Geometry does not contain any data');
|
throw new Error('Geometry does not contain any data');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matrix) {
|
if (matrix && matrix.isMatrix4) {
|
||||||
geometry.applyMatrix(matrix);
|
geometry.applyMatrix(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user