This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This module is a variant which supports document.write. If you need document.write use this instead | |
* Author: Deepak Subramanian @subudeepak(https://github.com/subudeepak) | |
* Distributed under MIT License | |
*/ | |
/*global angular */ | |
(function (ng) { | |
'use strict'; | |
app.directive('script', function() { | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A fast - numpy based - CPU functions that take a height map and generate a normal map from it | |
import numpy as np | |
import matplotlib.image as mpimg | |
# a function that takes a vector - three numbers - and normalize it, i.e make it's length = 1 | |
def normalizeRGB(vec): | |
length = np.sqrt(vec[:,:,0]**2 + vec[:,:,1]**2 + vec[:,:,2]**2) | |
vec[:,:,0] = vec[:,:,0] / length | |
vec[:,:,1] = vec[:,:,1] / length |