Reputation: 33
I want to fill this ellipse with count random points inside it any help I'd be glad.
What algorithm of actions?
Upvotes: 1
Views: 981
Reputation: 80325
To generate uniformly distributed points inside ellipse, use approach developed for disk and scale coordinates with needed ratio:
generate two random values
r = A * sqrt(random(0..1))
fi = 2 * Pi * random(0..1)
and point in ellipse with horizontal semiaxis A and vertical one B
x = center.x + r * cos(fi)
y = center.y + B / A * r * sin(fi)
If ellipse is rotated, also rotate these coordinates
Upvotes: 2