|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
>
> Not to make it any more complicated, but it might give a more compact code -
> what about calculating the array values by using abs(sin (somthing)), and that
> way when [theta] goes past the max, it automatically goes back to 0...
Yes, I see what you're getting at; very clever. I wouldn't have thought of it.
The only (temporary) trouble I see is that the sin wave has to jump back to zero
when it reaches its PEAK-- then a new positive sin wave needs to begin again
immediately. Etc. OR... the 'descending' part of the (positive) wave needs to
have its values reversed, so that the 'peak' is considered 'zero', and the array
values *increase* as the wave falls back to zero. (This would be for creating
the 2nd group of repeating X-array values.) Then the wave scheme starts over
again.
If either of these scenarios could be made to work, it would be an elegant
solution-- more beautiful than my 'brute-force' #for loop. ;-)
I still like my YY equation, though; seems to be rather compact and elegant
as-is (unless the OP just *wants* to use an array for the Y-values as well.)
Post a reply to this message
|
|