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

Feature Request: Multiple Coloured Particles #7

Open
vandan-revanur opened this issue Apr 14, 2023 · 1 comment
Open

Feature Request: Multiple Coloured Particles #7

vandan-revanur opened this issue Apr 14, 2023 · 1 comment

Comments

@vandan-revanur
Copy link
Contributor

I am trying to implement multiple coloured particles, however I am not able to add them into the same picture.

For example, I created a drawParticle_2 function:

drawParticle_2 :: Particle -> GG.Picture
drawParticle_2 (Particle _ (V2 x y) _) =
  GG.translate x' y' ( color (GG.circleSolid ( toPixels dotSize)))
  where
    x' = toPixels x
    y' = toPixels y
    color = GG.Color (GG.withAlpha 0.8 GG.green)

But I am not able to understand how I can add these green particles into the picture along with the existing blue particles.

Could you perhaps add a feature to add multiple coloured spheres ?

@mkDoku
Copy link
Owner

mkDoku commented Apr 16, 2023

Hi there!

What a great idea making it more colorful! I would suggest that you extend the Particle type, so that there is a entry for its Color. Then you would (mostly) only need to change the intial model for each simulations by giving each particle a Color.

By adding the function drawParticle_2 you would have to distinguish between this function and drawParticle which becomes quiet hard in the current setup.

I hope this helps.

I created the branch feature/multiple_colors so that you can have a look, how I would have solved the problem. These changes will not be merged into main (same as for #8).

Feel free to ask further question. If there are none, I would like to close the issue.

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

2 participants