21 return { .
fn = [anchor, strength](
const glm::vec3& p) -> glm::vec3 {
22 glm::vec3 delta = anchor - p;
23 float d = glm::length(delta);
25 return glm::vec3(0.0F);
26 return (delta / d) * (strength / std::max(d * d, 0.1F));
48 return { .
fn = [anchor, axis, strength](
const glm::vec3& p) -> glm::vec3 {
49 glm::vec3
radius = p - anchor;
50 glm::vec3 tangent = glm::cross(axis,
radius);
51 float d = glm::length(tangent);
53 return glm::vec3(0.0F);
54 return (tangent / d) * strength;
70 return { .
fn = [strength, rng](
const glm::vec3&)
mutable -> glm::vec3 {
Unified generative infrastructure for stochastic and procedural algorithms.
VectorField turbulence(float strength, Stochastic::Stochastic rng=Stochastic::Stochastic())
Uniform random force field using Stochastic infrastructure.
VectorField point_attractor(const glm::vec3 &anchor, float strength)
Radial attraction/repulsion toward an anchor point.
VectorField orbital(const glm::vec3 &anchor, const glm::vec3 &axis, float strength)
Tangential force perpendicular to both an axis and the radius vector.
std::function< R(const D &)> fn
Typed, composable, stateless callable from domain D to range R.