POV-Ray : Newsgroups : povray.newusers : Something strange is happening to me (again) : Re: Something strange is happening to me (again) Server Time
21 Oct 2025 08:32:34 EDT (-0400)
  Re: Something strange is happening to me (again)  
From: Bald Eagle
Date: 20 Oct 2025 13:50:00
Message: <web.68f67585377e8b3ac330b87125979125@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
> On 10/20/25 03:53, kurtz le pirate wrote:
> > Let an array of "4D" vectors.
> > This code works well :
> >
> > #write ( FH, Array[i].x,",",Array[i].y,",",Array[i].z,",",Array[i].filter )
>
> Below the contents of a documentation scene I'm adding to the next yuqk
> release (R20). What's going on is part of a larger tangle due when and
> how the features involved were implemented over time.
>
> Bill P.
>
> //---
> // Odd behavior with 'write' and 5D color vectors...
>
> #declare V2 = <1,2>;
> #declare V3 = <1,2,3>;
> #declare V4 = <1,2,3,4>;
> #declare V5 = <1,2,3,4,5>; // Internally this a 'color vector'
>
> #fopen FH "zzz" write
>
> // These are OK in yuqk or in v3.8 beta 2
> #write (FH,V3.x,",",V3.y,",",V3.z)
> #write (FH,V4.x,",",V4.y,",",V4.z,",",V4.t)
> #write (FH,(V5.x),",",(V5.y),",",(V5.z))
> #write (FH,(V5.x),",",(V5.y),",",(V5.z)",",(V5.t))
> #write (FH,(V5.x),",",(V5.y),",",(V5.z)",",(V5.t)",",(V5.transmit))
> #write (FH,V2)
> #write (FH,V3)
> #write (FH,V4)
>
> // This fails in yuqk and in v3.8 beta 2 because 'write' only
> // supports 2D, 3D and 4D vectors.
> #if (0)
> #write (FH,V5)
> #end
>
> // This fails in v3.8 beta 2 because 'write' only supports 2D, 3D
> // and 4D vectors. Due how the dot operator works, incorrectly,
> // for the v3.8 tuple feature the V5.transmit is first seen as a 5D
> // color vector - before it is seen as a float due the dot operator.
> #if (0)
> #write (FH,V5.transmit)
> #end
>
> // These fail in yuqk due fixes with the tuple assignment feature of
> // v3.8 which changes how the dot operators are evaluated. The yuqk
> // fork always sees 'V5' before it thinks about the dot operator. In
> // other words, with yuqk you must wrap all, 5D color vector, element
> // to float conversions in ()s with write!
> #if (0)
> #write (FH,V5.x,",",V5.y,",",V5.z)
> // #write (FH,V5.x,",",V5.y,",",V5.z,",",V5.t)
> // #write (FH,V5.x,",",V5.y,",",V5.z,",",V5.transmit)
> #end
>
> #fclose FH
>
> #error "Stop early"
> //---
>
> Bill P.

So,
I'm curious about all of this.
There seems to be an awful lot of bouncing around under the hood, and a fair
amount of replicated code for things like splines, etc.

How are the vector components stored, and why do they need to be recast into
floats?

I see that there is no 5d vector defined in math/vector.h - it is in
base/colour.h

Can we somehow consolidate/unify the colors and the vectors, or do we want to
somehow completely separate them with a means to interconvert as per clipka?


#write converts everything to strings first?


Post a reply to this message

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