POV-Ray : Newsgroups : povray.advanced-users : explicit vector type-casting in pov : Re: explicit vector type-casting in pov Server Time
6 Oct 2024 13:47:10 EDT (-0400)
  Re: explicit vector type-casting in pov  
From: Mike Williams
Date: 18 Oct 2006 00:26:36
Message: <vdB4IBAMuaNFFwi4@econym.demon.co.uk>
Wasn't it Tek who wrote:
>I have a vector with 4 components and I want to use the first 3 (xyz) as a 
>position, in a sphere sweep. But pov gives me "vector expected but color 
>expression found". As far as I can see the only way round this is the very 
>ugly <V.x,V.y,V.z>, because expresions like <1,1,1>*V start by promoting 
><1,1,1> to a 4-component vector!
>
>So, am I missing something? Is there some easy short hand to tell pov that 
>it's allowed to demote the vector to the appropriate type? really I want 
>something as simple as V.xyz, or even just V with it being implicit. Why 
>doesn't pov like 4D vectors for a 3D property, when x, y, and z are well 
>defined?
>
>Anyway, I'll do it the long winded way until someone educates me on this 
>subject! ;-)

You can write a little macro, like

     #macro v3(a)  <a.x, a.y, a.z>  #end

Then use  v3(V)  wherever you wanted to use  V.xyz

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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