• Advertisement
Sign in to follow this  

Picking points on a 5 pointed start uniformly at random

This topic is 2597 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am implementing some fireworks in opengl. I would like to have to cool firework effects. Right now all i have is when the rockets explode, then send sparks flying in random directions that are basically chosen by picking random points on a sphere. I would like to have a 2D star pattern though I am not sure how to pick points uniformly at random on a star. Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
Pick uniform random samples of the direction you want to go (from 0-2 pi), then, initialize the direction vector of the velocity to that direction. Next, compute the equation of a star in polar coordinates, and set the velocity magnitude equal to that direction. For example, the equation of

Share this post


Link to post
Share on other sites
Construct 10 line vectors that form the star shape. For each of the 10 lines on the star roll a fixed or random amount of numbers between 0 and the length of the line and use the line vectors to calculate destination points for the sparks. You could also move the destination points outwards or inwards along the normal of the line for some more randomness.

[Edit] Were you talking about a filled star or just the outline of a star? My suggested method is for the latter.

[Edited by - Mussi on December 11, 2010 8:17:55 AM]

Share this post


Link to post
Share on other sites
Build your star out of 10 congruent triangles. Pick a random triangle first, then pick a random point in the triangle.

I have other alternatives, but I think that's the best one.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement