atan2 noise expression


atan2 noise expression, usable with (x,y) or other noise-expression variables. Examples in data.lua

1 year, 3 months ago
0.17
31
Owner:
Honktown
Source:
N/A
Homepage:
N/A
License:
The Unlicense (Public Domain)
Created:
1 year, 3 months ago
Latest Version:
0.1.1 (1 year, 3 months ago)
Factorio version:
0.17
Downloaded:
31 times

Small atan2 expression library.

Changes from 0.1.0 to 0.1.1: slight difference in require (testing additional noise functions)
local extranoise = require "extranoise.lib"
local atan2xy = extranoise.atan2xy

atan2xy.load() - add atan2xy noise expression to data.raw["noise-expression"]

atan2xy.expr(x, y) - returns with atan2 usable in a new noise expression, without defining atan2xy

atan2xy.calculate(x,y) - returns atan2 calculated using the method of the library (meant for comparing to a real one like math.atan2)

The method used to calculate atan2 is an approximation. Accurate to within about +/- 0.005 radians. Percent error increases with smaller angles, but is still very small. The normally undefined point (0,0) returns pi/2. Range is (-pi, pi] for all x, y

Settings to load the atan2xy expression (default true) and to use it to modify coal's richness and probability (default false - enable to see it in a new game - would not recommend existing game)

See data.lua for some basic examples. Ask any questions. If something goes wrong, tell me pls

I may not keep this folder up-to-date, but here's a folder with sample data and some files for those who don't want to download the mod:
https://drive.google.com/open?id=15Mq08GzNdJyn1ovVMHnS55vFsee85v1d