diff options
| author | realtradam <[email protected]> | 2021-08-09 10:32:45 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2021-08-09 10:32:45 -0400 |
| commit | c1eb3f4c18404d4921adc3d38dfa7438a47f4aa0 (patch) | |
| tree | e0150085494d014dfbcdc1e6e2314fde62c9af1c /lib/rules/limit.rb | |
| parent | 501ec02e894865836f2960b0bbc16b3448e3707f (diff) | |
| download | ruboids-c1eb3f4c18404d4921adc3d38dfa7438a47f4aa0.tar.gz ruboids-c1eb3f4c18404d4921adc3d38dfa7438a47f4aa0.zip | |
initial piranha
Diffstat (limited to 'lib/rules/limit.rb')
| -rw-r--r-- | lib/rules/limit.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/rules/limit.rb b/lib/rules/limit.rb index c454de4..dba9f96 100644 --- a/lib/rules/limit.rb +++ b/lib/rules/limit.rb @@ -1,12 +1,12 @@ # This special function is already called by apply_boid_calculations.rb # do not add or call this function elsewhere FF::Sys.new('Limit') do - unless $limit < 0 + unless $config.limit < 0 FF::Cmp::Boids.each do |boid| absolute_velocity = Math.sqrt((boid.vx**2) + (boid.vy**2)) - if absolute_velocity > $limit - boid.vx = (boid.vx / absolute_velocity) * $limit - boid.vy = (boid.vy / absolute_velocity) * $limit + if absolute_velocity > $config.limit + boid.vx = (boid.vx / absolute_velocity) * $config.limit + boid.vy = (boid.vy / absolute_velocity) * $config.limit end end end |
