|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Kenneth" <kdw### [at] gmailcom> wrote:
> In the 16th century, the Inquisition would have burned Clipka at the stake, as a
> warning to other such Necromancers :-P
21st. Other than that, you're probably right.
Orwell just had the date wrong.
https://campus.aynrand.org/works/1943/01/01/the-soul-of-an-individualist/page1
https://duanegraham.files.wordpress.com/2012/07/s-e-cupp-rand-quote.jpg
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
clipka <ano### [at] anonymousorg> wrote:
> Challenge accepted ;)
>
> #declare MY_VALUE = 10;
> #for(C,1,19)
> #debug concat("\n","My Value = ",str(MY_VALUE,1,0),"\n")
> #declare MY_VALUE = 43-MY_VALUE;
> #end
So, I looked further into this, since it was so elegant,
and I came across this discussion, and further suggested improvement:
from:
https://stackoverflow.com/questions/18941019/simplest-way-to-toggle-a-integer-variable-between-two-values
( ^= operator is the XOR operator)
"Another way is to toggle an index between 0 and 1 and index an array with that:
int main() {
int const values[] = {0x55, 0xaa};
int selector = 0;
selector ^= 1; // toggle index
int value = values[selector]; // select value
}
This is also future-resistant. If in the future OP wants to round-robin between
3, 4, or N values, just add to the array and change selector ^= 1 to selector =
(selector+1)%N."
------
I'm unfamiliar with the bitwise operators in POV-Ray, so interpreting the docs
is a bit unclear to me.
"bitwise_xor(A,B,...)
Bitwise XOR of two or more float values considered as integers."
This would make a sweet little macro for people to use in lots of future scene
files - so good, it should be in one of the standard include files.
I might try to code it up tonight, unless someone beats me to it ;)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> I might try to code it up tonight, unless someone beats me to it ;)
or over lunch :D
Like so:
#macro CycleValues (_Array, _Counter)
// Round-robin cycle through N values
// Bill Walker September 2017
#local N = dimension_size (_Array, 1);
#local selector = mod (_Counter, N);
// selector will range from 0 to N-1
// Return the value in _Array corresponding to _Counter
_Array [selector]
#end // end macro CycleValues
#declare RoundRobin = array [4] {2, 5, 9, 13};
#for (i, 0, 10)
#declare Value = CycleValues (RoundRobin, i);
#debug concat ("Array value for i=", str(i, 2, 0), " is ", str(Value, 3, 0),
"\n")
#end // end for i
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 11.09.2017 um 19:46 schrieb Bald Eagle:
>
>> I might try to code it up tonight, unless someone beats me to it ;)
>
> or over lunch :D
>
> Like so:
>
> #macro CycleValues (_Array, _Counter)
> // Round-robin cycle through N values
> // Bill Walker September 2017
> #local N = dimension_size (_Array, 1);
> #local selector = mod (_Counter, N);
> // selector will range from 0 to N-1
> // Return the value in _Array corresponding to _Counter
> _Array [selector]
> #end // end macro CycleValues
>
>
> #declare RoundRobin = array [4] {2, 5, 9, 13};
> #for (i, 0, 10)
> #declare Value = CycleValues (RoundRobin, i);
> #debug concat ("Array value for i=", str(i, 2, 0), " is ", str(Value, 3, 0),
> "\n")
> #end // end for i
Invoking a macro in a loop? Can't imagine this to be of any use in terms
of efficiency ;)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|