function reduceVertices( object, func, initialValue ) {

	let value = initialValue;
	const vertex = new Vector3();

	object.updateWorldMatrix( true, true );

	object.traverseVisible( ( child ) => {

		const { geometry } = child;

		if ( geometry !== undefined ) {

			const { position } = geometry.attributes;

			if ( position !== undefined ) {

				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;

}
Executes a reducer function for each vertex of the given 3D object.
`reduceVertices()` returns a single value: the function's accumulated result.

@param {Object3D} object - The 3D object that should be processed. It must have a
geometry with a `position` attribute.
@param {function(number,Vector3):number} func - The reducer function. First argument
is the current value, second argument the current vertex.
@param {any} initialValue - The initial value.
@return {any} The result.