POV-Ray : Newsgroups : povray.beta-test : [includes] VPow does not work : Re: [includes] VPow does not work Server Time
29 Jul 2024 08:24:53 EDT (-0400)
  Re: [includes] VPow does not work  
From: Warp
Date: 15 Jun 2002 16:35:17
Message: <3d0ba505@news.povray.org>
Rune <run### [at] mobilixnetdk> wrote:
> That's great! Could you make it detect 2d (UV) vectors too? Of cpurse it
> should then not return yes or no, but rather 2, 3 or 5.

  Well, you could count the amount of 1's in the string. I think that should
be the correct answer (I haven't tried what happens when you do a (V=V) with
V being a 2D vector, but I think it should return <1,1>).
  Of course that's even slower because you'll have to call substr() at least
two times. Don't know if that matters in practice (after all, the string is
very short).

  Perhaps something like:

#macro VectorSize(V)
  #local tmp = vstr(5, (V=V), "", 0, 0);
  (2 + (asc(substr(tmp,3,1))=49) + 2*(asc(substr(tmp,5,1))=49))
#end

#declare V1 = <1,2>;
#declare V2 = <3,4,5>;
#declare V3 = <6,7,8,9,10>;

#debug concat("Size of V1: ", str(VectorSize(V1),0,0),
            "\nSize of V2: ", str(VectorSize(V2),0,0),
            "\nSize of V3: ", str(VectorSize(V3),0,0), "\n")


-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

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