POV-Ray : Newsgroups : povray.general : Github repository with useful macros : Re: Github repository with useful macros Server Time
14 Apr 2024 21:58:10 EDT (-0400)
  Re: Github repository with useful macros  
From: Bald Eagle
Date: 21 May 2021 06:45:00
Message: <web.60a78dd0985098ff1f9dae3025979125@news.povray.org>
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:

> When I see this I'm thinking that users that try to calculate the mean or
> variance of an array containing mixed vectors deserves the messy result that
> they may get.
> My opinion is that POV-Rays automatic vector promotion is a design flaw. It
> allows users to write code that is confusing and not so clear. And it creates
> some hard to find errors.

I would agree that some features are more problematic than others, especially
for newer users.   Is there a way to add, multiply, or test for [nonexistant]
vector components with dot-notation in order to purposefully invoke the vector
promotion and force everything to me the largest vector size (5?) from the

[Just as a related aside, what would be useful is a way to perform typical
mathematical functions like cosine on vectors and get a vector result.]

> We can not, and should not, try to anticipate and warn/guard against all the
> crazy things that users may do with macros. That would make them big, clumsy and
> hard to read and understand.

True, however one can have a scene containing all the cases one might think are
tricky or at least not obvious, and that allows plenty of room for doing all
sorts of things that have no proper place in a macro.
Macros, functions, and the documentation are the (overly brief) textbooks of
POV-Ray.  Scene files are the lecture and recitation notes.

In engineering, the rule of thumb for how tight a bolt should be is, "Torque it
down until it snaps, then back it off a half a turn."  That's valuable knowledge
to have which is easy to say and scribble on a blackboard, or show in a
demonstration.  However, it's probably not going to make it into the textbook.

> If we keep the macros like they are now, then yes; we should have a user beware
> warning.

This is always the most difficult and painful part of writing real-world code.

- Bill

Post a reply to this message

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