POV-Ray : Newsgroups : povray.general : Github repository with useful macros : Re: Github repository with useful macros Server Time
4 May 2024 03:36:18 EDT (-0400)
  Re: Github repository with useful macros  
From: Bald Eagle
Date: 22 May 2021 18:05:00
Message: <web.60a97f73985098ff1f9dae3025979125@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

> I'm fuzzily thinking that maybe
> there's a way to disambiguate a 5D vector and a scalar by adding and/or
> multiplying with vectors containing different signs and testing the result?
>
> My brain is also giving me the impression that binary math and things like (I
> said _like_) bitmasks and xor might offer inspiration for a solution.

I got most of the way there by finally realizing that a scalar added to a 5D
vector adds the scalar to ALL of the vector components, whereas with a vector
added to a 5D vector, automatic vector expansion pads the smaller vector with
zeros, and then the corresponding components are added to each other.

The really tricky part I've mostly ironed out is differentiating scalar 0 and
the all-zero-vectors.

I had some real trouble getting it work for the 5D zero vector, but I made a
hack that seems to work. (See Vdiscrim calculation and D1 logic)
Maybe to be robust, there needs to be a walk up to 5D and then back down
again...


It's a little messy and complex, because I wrote it by feel and flashes of
inspiration rather than pure rigor, but it seems to work for most cases I've
plugged in.

Now, you know what to do:  Take it and Break it.


Post a reply to this message


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

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