Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cause of the outlier curves? #1

Open
nitz opened this issue Jun 30, 2022 · 0 comments
Open

Cause of the outlier curves? #1

nitz opened this issue Jun 30, 2022 · 0 comments

Comments

@nitz
Copy link

nitz commented Jun 30, 2022

Hey! I just wanted to say thanks for sharing this, I've been obsessed with it a for a good little bit now. (Gonna have to pick up the Stormlight series, I guess 🤷🏻‍♀️)

I recently decided I wanted to be able to generate curves in .NET languages without needing python and numpy, so I spent a little bit recently porting it. I definitely planning on sharing it as well, once it's cleaned up some.

So far I mostly a very close translation of the way you pre-slice and sample for the number of requested curves. Since I've been learning a bit more about how you accomplish everything, I've started looking at adding a "real time" simulation mode, so that I can spawn a number of "particles" (you refer to them as particles a few times, but at the moment I'm calling them Boids, because I really don't know what name to give them), and let them update/roam freely over time, and likely in three dimensions as well. (Probably to be used in a game engine or the sort, eventually.)

The big question I had for you was one I thought came from mistakes I made while translating the code to C#, but I realized the behavior is indeed repeatable with the python flavor if I set it up (and force seed the RNG to get predictable outputs.) Essentially, I'm trying to track down the biggest reasons for curves to get thrown out. Your script generates in two passes, chucking any outliers and then re-generating to fill their place. I'm currently just using a "keep generating until I've hit the desired number" approach, but have noticed depending on the whims of random, it can get a little erratic with forces that approach large numbers or +/- infinity, causing curves to get scrapped.

As the math itself doesn't quite gel with me yet, I can' tell if that's just the nature of how each subsequent chunk of the curve gets it's trajectory processed, attempting to stay in bounds with the samples it has left? I don't think this will be a big issue when I get to doing the real-time bit, because best I can tell the giant forces seem to be coming from around when it's close to the end of the samples and has a very small (or even 0) rest time:

https://github.com/moews/smurves/blob/master/smurves/smurves.py#L678-L682

I'm gonna keep pushing ahead for the time being and hope that doesn't gum up things later on, but figured I'd ask if you've got any idea on what might be the root cause of it. (Perfectly valid if the answer is "who cares just throw out bad values 😅")

Because no ticket should exist without pretty pictures, here's a couple curves generated and rendered through the current .NET fork, via LINQPad:

logarythmic-curves
linear-time-curves

They're just too pretty. Fantastic job working this up.

Cheers, and thanks a heap!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant