genesis {particles}R Documentation

Particle initialisation

Description

These functions are passed to the simulation and defines how the position and velocity of the particles are initiated. The default is to lay out the nodes in a phyllotactic arrangement (think sunflower seeds) and with no velocity, which is also the default in d3-force.

Usage

phyllotactic_genesis(radius = 10, angle = pi * (3 - sqrt(5)))

predefined_genesis(x, y, x_vel = 0, y_vel = 0)

bigbang_genesis(vel_min = 0, vel_max = 1)

aquarium_genesis(width = 10, height = 10, vel_min = 0, vel_max = 1)

petridish_genesis(max_radius = 10, vel_min = 0, vel_max = 1)

Arguments

radius

The radius modifier (will be multiplied by the square root of the index of the particle)

angle

The angular difference between two adjacent particles

x, y

The columns holding (or value of) the position coordinates

x_vel, y_vel

The columns holding (or value of) the velocity verlets

vel_min, vel_max

The bounds of the uniformly distributed velocities

width, height

The size of the rectangle holding the particles

max_radius

The size of the disc.

Value

A function that takes the particle graph and returns a list with a position and velocity element, each holding a matrix with two columns and a row for each particle giving the x and y position and velocity respectively.

Functions

Examples

# A contrieved example
graph <- tidygraph::create_notable('bull')
genesis <- phyllotactic_genesis()
genesis(graph)

# Usually used as an argument to simulate
graph |>
  simulate(setup = phyllotactic_genesis())


[Package particles version 0.2.3 Index]