genesis: Particle initialisation

Description Usage Arguments Value Functions Examples

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

1
2
3
4
5
6
7
8
9
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

1
2
3
4
5
6
7
8
# 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())

thomasp85/particles documentation built on Jan. 15, 2019, 2:25 a.m.