/R_demos

data processing in R

Primary LanguageR

R_demos

Data processing in R

Terrain gen

Using spotty noise and the vectorized recursive function "block" within r_terrain_demo.R, we can create heightmaps in R. Then we can pass a blurring kernel over the spotty terrain several times, transforming it from a spotty discrete surface into a blurry one.

Kernel 1

The R graphics libary (RGL) can be used to display the 2D heightmap as a 3D surface.

Kernel 4

Sufficiently-blue noise

Occasionally it is useful to have a group of points which are not overlapping, but are otherwise random. See Wikipedia: blue noise. While there are very complicated implementations of blue noise out there, they are often unnecessarily difficult for applications outside statistics research.

We can use an equation like

to give a grid of points in 2D (or with a few easy changes, 3D) space.

Then using we can draw a few edges between nodes/points.

Blue noise edges