Page 1 of 1

Ulam Spiral Prime Numbers

Posted: Tue Oct 01, 2013 7:48 am
by nlexa
Is there a limit to the number of points you can set in a graphic object?
Or perhaps you can't have more than 380000x2 lines in a variable?

I find that once I exceed around 380000 points that it forgets the first 380000 and continues drawing from there leaving a black square in the middle. Also if I show the progress bar updating as it goes through each loop it adds 10x the length of time for it to complete the function.

I've tried using the "select brush" and "drag from point to point" method for each dot but drawing pixels on the screen takes phenomenally long in live code and "select pencil" and "click at loc" takes even longer.

Anyway here is my stack. It makes a pretty ulam spiral of prime numbers
PrimeSpiral1.zip
(67.43 KiB) Downloaded 255 times

Re: Ulam Spiral Prime Numbers

Posted: Tue Oct 01, 2013 3:14 pm
by FourthWorld
nlexa wrote:I find that once I exceed around 380000 points that it forgets the first 380000 and continues drawing from there leaving a black square in the middle.
There's probably a limit on the number of points of some sort, but the first thing I'd check is the algo generating them.

One quick test is to add this line just before setting the points:

Code: Select all

put (cr&cr is in tList) -- NEW
set the points of graphic "Spiral" to tList
When a list of points contains a blank line, it will cause the resulting polygon to be discontiguous. Often this is very useful, but if it's not what you're looking for then you may need to review the script to find out why it's generating at least one blank line.

Re: Ulam Spiral Prime Numbers

Posted: Wed Oct 02, 2013 12:43 am
by nlexa
FourthWorld wrote:When a list of points contains a blank line, it will cause the resulting polygon to be discontiguous. Often this is very useful, but if it's not what you're looking for then you may need to review the script to find out why it's generating at least one blank line.
I checked it again. The variable can hold the points but it is the graphic object that cant hold much more than 65500 lines of coordinates. I guess a graphic object that has 32750 points is fairly complex.
Is there a way to increase this limit? Perhaps I simply have to split it across objects.