POV-Ray : Newsgroups : povray.general : Github repository with useful macros : Re: Github repository with useful macros Server Time
21 Apr 2024 07:19:22 EDT (-0400)
  Re: Github repository with useful macros  
From: Tor Olav Kristensen
Date: 21 May 2021 16:15:00
Message: <web.60a81382985098ff47eee7f589db30a9@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
> On 5/19/21 3:55 PM, Tor Olav Kristensen wrote:
> > I have also rewritten a few of the macros slightly and added some new ones.
> >
> I like how macros using functions of transforms & inverse transforms
> ended up. :-) Those, I didn't expect you to change and yet what you did
> looks to me to be a clever approach to handling a macro's dynamically
> defined functions.


The global namespace for functions have troubled me for many years. Local
variables inside macros holding functions does not really work the way it IMHO

Now I'll go through some of my other old macros to see if the same trick can be
applied in any of them to get rid of "named functions".

I also wonder if "hiding" functions inside an array or a dictionary is a good
and robust way to avoid function related name clashes. But I guess we will still
have to struggle with name clashes related to the function parameters.

> I'll have to spend more time thinking about it and the actual inner
> workings. I suspect you've gotten to something near like what happens
> with prod and sum internally with the vm.

Sorry, but I don't understand what you mean here. I've never studied the
internals of that vm.

> I've recently moved the vector analysis macros in math.inc to a
> vectoranalysis.inc include - which itself won't be a 'core' include.
> Thinking the array statistics a better fit in a similar
> arraystatistics.inc include - again now not a 'core' include.

I agree with you, neither the vector analysis macros nor the array statistics
macros belong in a core include file. They are for users with special needs.

> With your vectors.inc, on the other hand, I'm starting to lean toward it
> being a 'core' include file. Need to resolve collisions with math.inc
> macros as a start.

I'm happy to hear that :)

I've now added some documentation for vectors.inc in the Github repository.

> Aside: Instead of moving some of the contents of arraycoupleddf3s.inc to
> arrays.inc, I went the other way! I moved the ARRAY_WriteDF3 macro into
> arraycoupleddf3s.inc alongside the ARRAY_ReadDF3 macro already therein
> along with some other DF3 related macros. I dropped too the ARRAY_
> prefixes. I now plan to treat arraycoupleddf3s.inc as a core include
> file. I believe reading and writing DF3s should be doable from SDL as
> 'POV-Ray' is shipped.

Yes, that is a sensible move.

Have you considered using sum() in the FnctNxNx9ArrayEntryToDBL() macro in
arraycoupleddf3s.inc ?

Tor Olav

Post a reply to this message

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