Math utils
These are wgsl functions, not js functions. The function is enclosed in a js string constant, to be appended into the code to reference it in the string shader.
- Source:
- core/math.js, line 1
Members
staticconstantE
E is a mathematical constant approximately equal to 2.71828 that is the base of the natural logarithm and exponential function. It is sometimes called Euler's number, after the Swiss mathematician Leonhard Euler.
Example
import { E } from 'points/math'; // wgsl string ${E} let value = E - 1.3;
js
staticconstantPHI
PHI is the Golden Ratio
- Source:
- core/math.js, line 51
- See:
- https://en.wikipedia.org/wiki/Golden_ratio
Example
import { PHI } from 'points/math'; // wgsl string ${PHI } let value = PHI + 3;
js
staticconstantPI
PI is the ratio of a circle's circumference to its diameter.
- Source:
- core/math.js, line 23
- See:
- https://en.wikipedia.org/wiki/Pi
Example
import { PI } from 'points/math'; // wgsl string ${PI} let value = PI * 3;
js
staticconstantTAU
TAU is the ratio of a circle's circumference to its radius.
Example
import { TAU } from 'points/math'; // wgsl string ${TAU} let value = TAU / 3.5;
js
staticconstantpolar String
Using polar coordinates, calculates the final point as vec2f
- Source:
- core/math.js, line 83
Example
import { polar } from 'points/math'; // wgsl string ${polar} let value = polar(distance, radians);
js
staticconstantrotateVector String
Rotates a vector an amount of radians
- Source:
- core/math.js, line 103
Example
import { rotateVector } from 'points/math'; // wgsl string ${rotateVector} let value = rotateVector(position, radians);
js