Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/jonasmb/curlnoisejittering
26 February 2024, 12:47:05 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    No releases to show
  • 4146b66
  • /
  • perlinnoise.py
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge Iframe embedding
swh:1:cnt:b9c2a620241249af7ffdd0a5a78b321568922d73
origin badgedirectory badge Iframe embedding
swh:1:dir:4146b66659713ac5969f449907e4a1160c43ffdb
origin badgerevision badge
swh:1:rev:42ba8b5ee132682b7804c6f47a7e1b91d6d73c9d
origin badgesnapshot badge
swh:1:snp:136874afdeced8f40934fc4a5f8b6a29cadc3556
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 42ba8b5ee132682b7804c6f47a7e1b91d6d73c9d authored by Jonàs Martínez on 26 February 2024, 12:21:49 UTC
Add Worley noise image 250x250 pixels
Tip revision: 42ba8b5
perlinnoise.py
from numba import njit
import numpy as np
from common import vec2

@njit
def hash2d(x):
	p1 = 73856093
	p2 = 19349663
	p3 = 83492791
	K = 93856263
	i = int(x[0])
	j = int(x[1])
	h1 = ((i * p1) ^ (j * p2)) % K
	h2 = ((j * p1) ^ (i * p3)) % K
	return vec2(h1,h2) / float(K) - 0.5

@njit	
def perlin_noise_grad( p ):
	x = p[0:2]
	'''returns 3D value noise (in [0])  and its derivatives (in .yz)'''
	i = np.floor(x)
	f = x-i	

	u = f*f*f*(f*(f*6.0-15.0)+10.0)
	du = 30.0*f*f*(f*(f-2.0)+1.0)
    
	ga = hash2d( i + vec2(0.0,0.0) )
	gb = hash2d( i + vec2(1.0,0.0) )
	gc = hash2d( i + vec2(0.0,1.0) )
	gd = hash2d( i + vec2(1.0,1.0) )
	#print(ga, gb,gc,gd)
    
	va = np.dot( ga, f - vec2(0.0,0.0) )
	vb = np.dot( gb, f - vec2(1.0,0.0) )
	vc = np.dot( gc, f - vec2(0.0,1.0) )
	vd = np.dot( gd, f - vec2(1.0,1.0) )

	grd =  ga + u[0]*(gb-ga) + u[1]*(gc-ga) + u[0]*u[1]*(ga-gb-gc+gd) + (vec2(u[1],u[0])*(va-vb-vc+vd) + vec2(vb,vc) - va)*du
	return grd
	# return vec3( va + u[0]*(vb-va) + u[1]*(vc-va) + u[0]*u[1]*(va-vb-vc+vd),
    #             grd[0], grd[1])

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top