Skip to content

Instantly share code, notes, and snippets.

View geekyorion's full-sized avatar
👽
Invading JavaScript

Shashank Sharma geekyorion

👽
Invading JavaScript
View GitHub Profile
@geekyorion
geekyorion / GLSL-Noise.md
Created December 30, 2022 10:16 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
@geekyorion
geekyorion / sqrt.js
Created November 27, 2022 20:06 — forked from animatedlew/sqrt.js
Here is an implementation of a square root function in JavaScript using Newton's method.
var sqrt = function(x) {
var isGoodEnough = function(guess) {
return Math.abs(guess * guess - x) / x < 0.001;
};
var improve = function(guess) {
return (guess + x / guess) / 2;
};
var sqrIter = function(guess) {