<commit_before># Equirect map to cubemap faces

Function that convert an equirectangular/latlong map into an array of cubemap faces (like you would use to send to OpenGL).

## Usage

Works in the browser or as a commonjs module. Provides a single function `equirectToCubemapFaces(image, faceSize)`. The face size is optional, and defaults to the nearest power of two to image.width/4 (this is totally arbitrary). The `image` argument can be an img element, a canvas, or an ImageData.

Usage example: [see on codepen](http://codepen.io/thomcc/pen/YqXQoo/)

function loadImage(src) {
	return new Promise(function(resolve, reject) {
		var i = new Image();
		i.onload = function() { resolve(i); }
		i.onerror = reject;
		i.src = src;
	});
}

loadImage(myImageURL)
.then(function(i) {
	var cs = equirectToCubemapFaces(i);
	cs.forEach(function(c) {
		document.body.appendChild(c);
	});
});

TODO: support for running this outside the browser (the function that does the bulk of the work already supports this...).

## License<commit_msg>Updated README with codeblock markdown<commit_after># Equirect map to cubemap faces

Function that convert an equirectangular/latlong map into an array of cubemap faces (like you would use to send to OpenGL).

## Usage

Works in the browser or as a commonjs module. Provides a single function `equirectToCubemapFaces(image, faceSize)`. The face size is optional, and defaults to the nearest power of two to image.width/4 (this is totally arbitrary). The `image` argument can be an img element, a canvas, or an ImageData.

Usage example: [see on codepen](http://codepen.io/thomcc/pen/YqXQoo/)

```js
function loadImage(src) {
	return new Promise(function(resolve, reject) {
		var i = new Image();
		i.onload = function() { resolve(i); }
		i.onerror = reject;
		i.src = src;
	});
}

loadImage(myImageURL)
.then(function(i) {
	var cs = equirectToCubemapFaces(i);
	cs.forEach(function(c) {
		document.body.appendChild(c);
	});
});
```

TODO: support for running this outside the browser (the function that does the bulk of the work already supports this...).

## License
{'fraction_non_alphanumeric': 0.10586552217453506, 'fraction_numerical': 0.0009537434430138292, 'mean_word_length': 4.44935064935065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2666135', 'n_tokens_mistral': 673, 'n_tokens_neox': 660, 'n_words': 252}