thomasp85 / particles

A particle simulation engine based on a port of d3-force
Other
119 stars 9 forks source link

Suggestion for fix of issue #8 #9

Closed Waschina closed 3 years ago

Waschina commented 3 years ago

Cause of issue was, that particles that are pulled back into a polygon by polygon_constraint receive new coordinates, which are still not recognised as inside the polygon by the function mgcv::in.out(...).

Here suggested solution: Introduce a tolerance level (2e-308) of a distance that a particle can be away from the polygon's boundaries. Only particles with a distance larger than this tolerance level are subject for placement updates by the polygon constraint.

The chosen tolerance level is based on R's double precision range.

Waschina commented 3 years ago

Hi @thomasp85 , I now tested the pull-request changes on different linux and MacOS systems. The particles package compiled and installed without any errors/warnings and the issue #8 is resolved with the changes.

I can't figure out why the automatic checks in github (or better AppVeyor) failed. Is there anything else I need to do or can help with, so that the pull request could be merged into thomasp85:master?

Best wishes Silvio

thomasp85 commented 3 years ago

This is because I haven't updated particles to a more modern CI setup...

This looks good - Thanks!!