import { Vector3 } from "../../../build/three.module.js";
function reduceVertices(object, func, initialValue) {
  let value = initialValue;
  const vertex = new Vector3();
  object.updateWorldMatrix(true, true);
  object.traverseVisible((child) => {
    const { geometry } = child;
    if (geometry !== void 0) {
      const { position } = geometry.attributes;
      if (position !== void 0) {
        for (let i = 0, l = position.count; i < l; i++) {
          if (child.isMesh) {
            child.getVertexPosition(i, vertex);
          } else {
            vertex.fromBufferAttribute(position, i);
          }
          if (!child.isSkinnedMesh) {
            vertex.applyMatrix4(child.matrixWorld);
          }
          value = func(value, vertex);
        }
      }
    }
  });
  return value;
}
export {
  reduceVertices
};
//# sourceMappingURL=SceneUtils.js.map
