trap_force {particles} | R Documentation |
Attract and trap particles within polygons
Description
This force creates a trap based on any type of polygon that attracts particles as long as they are outside the polygon, while leaving particles inside the polygon unaffected. The trap as such has no walls and particles are allowed to leave it, but they will be pulled back as soon as they exits the polygon.
Training parameters
The following parameters defines the training of the force and can be passed
along a call to wield()
-
polygon
: A two column matrix giving the corners of the polygon, or a list of matrices to use multiple polygons. If multiple polygons are overlapping it is considered a hole. -
strength
: The attractive force applied to the particle. Particles are attracted towards the closest part of the polygon, rather than the center, and the attraction is stronger for particles moving away from the polygon than for those moving towards it. (tidy eval) -
min_dist
: A lower distance threshold below which the strength is not increased. The attraction of the trap falls of with the square of the distance to the particle, so particles close by can get an enormous attraction unless this threshold is set (so much that the shoot out of the other side of the trap). -
distance_falloff
: How should the attractive force deteriorate with the distance between the polygon and the particle. Defaults to 2 (quadratic falloff) (tidy eval)
See Also
Other forces:
center_force
,
collision_force
,
field_force
,
link_force
,
manybody_force
,
map_force
,
mean_force
,
random_force
,
reset_force
,
x_force
,
y_force