POV-Ray : Newsgroups : povray.general : Github repository with useful macros : Re: Github repository with useful macros Server Time
20 May 2025 11:58:56 EDT (-0400)
  Re: Github repository with useful macros  
From: Bald Eagle
Date: 19 May 2025 19:50:00
Message: <web.682bc388985098ff1f9dae3025979125@news.povray.org>
I do believe I have cracked the code!
I made a big spreadsheet to get a better overview of everything that was
happening with additions and automatic vector promotion.

It took me a while to get a good feel for what was possible, and what was just
going around in circles.
I was also concerned about all zero values being a special case.

Then I got some inspiration for leveraging the "asymmetry" afforded by the rgb
keyword.  Squaring v0 gives me all-positive values, so when I add 1 to the
result, I'm not losing the result I want when v0 is some form of -1.
Then I add the rgb conversion of that value, and that lets me differentiate
between scalars and all sizes of vectors.

I started making a huge list of test values, but I'm sure there's a better way
to automate the generation of 1D-5D values with all possible combinations of -,
0, +.

At the moment, I haven't run across any values that get improperly identified.
I separately list all vector components to show that accessing the individual
dot-notation components doesn't raise a "Bad operands for period operator"
error.

(I tried to use -GW or Warning_Console=Off, but the "Suspicious expression after
rgb" error doesn't get suppressed)

Check it out.
Hammer on it.
Try to break it.

- Bald "Nothing is Impossible!" Eagle


Post a reply to this message


Attachments:
Download 'vectoroperations.pov.txt' (4 KB)

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.