While Loop Problem
1133 8 2- martinalex
- Member
- 20 posts
- Joined: 10月 2021
- Offline
Hi everyone, so I want to create a VEX code where I can scatter random circles into this grid without intersection. I am a little bit stuck while I'm doing the "While()" loop. Basically, what I need is that if the circles are intersecting, I need it to change the scattered seed. Does anybody know how to fix it? Thanks in advance!
- cncverkstad
- Member
- 123 posts
- Joined: 8月 2017
- Offline
- Konstantin Magnus
- Member
- 670 posts
- Joined: 9月 2013
- Offline
- martinalex
- Member
- 20 posts
- Joined: 10月 2021
- Offline
cncverkstadActually, I'm trying to do it like this. http://paulbourke.net/fractals/randomtile/ [paulbourke.net] . By the way, that's quite an interesting result you got there. Is it okay if you send the hip file as well?
something like this Or?
Edited by martinalex - 2023年6月2日 07:14:57
- martinalex
- Member
- 20 posts
- Joined: 10月 2021
- Offline
Konstantin MagnusThank you for the link. It is quite similar to what my goal is, which is like this, http://paulbourke.net/fractals/randomtile/ [paulbourke.net] . The only problem that I'm seeing is that it uses a solver for it. I'm wondering if it can be done without a solver.
This tutorial might help:
https://youtu.be/Y1UC3T9l15U [youtu.be]
- ajz3d
- Member
- 478 posts
- Joined: 8月 2014
- Offline
Take a look at @tamte's example file: https://www.sidefx.com/forum/topic/18255/#post-85827 [www.sidefx.com]
- martinalex
- Member
- 20 posts
- Joined: 10月 2021
- Offline
ajz3dThanks for the link. It is quite similar to what I'm aiming for, however, I do notice that there is not much size difference between the circles, and there are still some empty spaces that need to be filled.
Take a look at @tamte's example file: https://www.sidefx.com/forum/topic/18255/#post-85827 [www.sidefx.com]
- Aizatulin
- Member
- 480 posts
- Joined: 7月 2005
- Offline
Here is a modification of your file. The algorithm should be similar to the algorithm in the link you have given.
In fact it is repeating, to find a random location on a grid, where there is "enough" space to find a circle with a specific radius. The problem is, that the remaining space can get very small, that it is almost impossible to find a valid position for the next circle, because the probability is getting smaller with each circle and there is no guarantee that it finds such a position. So in this case it might be better to omit this circle and try another (smaller) one.
In fact it is repeating, to find a random location on a grid, where there is "enough" space to find a circle with a specific radius. The problem is, that the remaining space can get very small, that it is almost impossible to find a valid position for the next circle, because the probability is getting smaller with each circle and there is no guarantee that it finds such a position. So in this case it might be better to omit this circle and try another (smaller) one.
- martinalex
- Member
- 20 posts
- Joined: 10月 2021
- Offline
AizatulinWow, thank you so much for your help. This is much harder than I think it was supposed to be. Yeah, I guess that it is better and faster to omit the circle than keep finding a random position until we found the valid one.
Here is a modification of your file. The algorithm should be similar to the algorithm in the link you have given.
In fact it is repeating, to find a random location on a grid, where there is "enough" space to find a circle with a specific radius. The problem is, that the remaining space can get very small, that it is almost impossible to find a valid position for the next circle, because the probability is getting smaller with each circle and there is no guarantee that it finds such a position. So in this case it might be better to omit this circle and try another (smaller) one.
-
- Quick Links