|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
VPow in math.inc does not work, because pow only works with floats.
POV 3.5 RC6
Simon
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Simon Adameit wrote:
> VPow in math.inc does not work, because pow only works with floats.
I presume it should work correct if it is changed to be like this below?
// Raises the components of a vector to a given power
#macro VPow(V, P) <pow(V.x, P), pow(V.y, P), pow(V.z, P)> #end
#macro VPow5D(V, P) <pow(V.x, P), pow(V.y, P), pow(V.z, P),
pow(V.filter, P), pow(V.transmit, P)> #end
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated May 20)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Ring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Rune <run### [at] mobilixnetdk> wrote:
> // Raises the components of a vector to a given power
> #macro VPow(V, P) <pow(V.x, P), pow(V.y, P), pow(V.z, P)> #end
> #macro VPow5D(V, P) <pow(V.x, P), pow(V.y, P), pow(V.z, P),
> pow(V.filter, P), pow(V.transmit, P)> #end
I wonder if there would be some ingenious way of detecting the type of
vector given as parameter and then creating the same type of vector as
result. This way one macro would suffice.
--
#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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> I wonder if there would be some ingenious way of
> detecting the type of vector given as parameter and
> then creating the same type of vector as result.
> This way one macro would suffice.
Yes, if it is possible to detect, I'd be interested. Especially since
there are several other macros in math.inc which also come in several
versions due to the various types of vectors.
But I don't know of such a method.
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated May 20)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Ring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Rune <run### [at] mobilixnetdk> wrote:
> Yes, if it is possible to detect, I'd be interested. Especially since
> there are several other macros in math.inc which also come in several
> versions due to the various types of vectors.
> But I don't know of such a method.
I found a method. It may not be the fastest possible, but at least it works.
#macro Is5DVector(V)
(strcmp(vstr(5, (V=V), "", 0, 0), "11111") = 0)
#end
#declare V1 = <1,2,3>;
#declare V2 = <4,5,6,7,8>;
#if(Is5DVector(V1)) #debug "yes, " #else #debug "no, " #end
#if(Is5DVector(V2)) #debug "yes" #else #debug "no" #end
#debug "\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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> I found a method. It may not be the fastest possible, but at least
> it works.
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.
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated May 20)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Ring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Actually it can be made to work for floats as well:
#macro VectorSize(V)
#local tmp = vstr(5, (V=V), "", 0, 0);
(1 + (asc(substr(tmp,2,1))=49)+ (asc(substr(tmp,3,1))=49) +
2*(asc(substr(tmp,5,1))=49))
#end
#declare V0 = 0;
#declare V1 = <1,2>;
#declare V2 = <3,4,5>;
#declare V3 = <6,7,8,9,10>;
#debug concat("Size of V0: ", str(VectorSize(V0),0,0),
"\nSize 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 N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Why don't you add four-dimensional vectors, just to make it complete?
Anders
--
light_source{6#local D=#macro B(E)#macro A(D)#declare E=(E-#declare
C=mod(E D);C)/D;C#end#while(E)#if(A(8)=7)#declare D=D+2.8;#else#if(
C>2)}torus{1..2clipped_by{box{-2y}}rotate<1 0C>*90translate<D+1A(2)
*2+1#else}cylinder{0(C-v=1).2translate<D+C*A(2)A(4)#end-2 13>finish
{specular 1}pigment{rgb x}#end#end#end-8;1B(445000298)B(519053970)B
(483402386)B(1445571258)B(77778740)B(541684549)B(42677491)B(70)}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Anders K. <and### [at] prostard2gcom> wrote:
> Why don't you add four-dimensional vectors, just to make it complete?
Yes, why not?
#macro VectorSize(V)
#local tmp = vstr(5, (V=V), "", 0, 0);
(1 + (asc(substr(tmp,2,1))=49) +
(asc(substr(tmp,3,1))=49) +
(asc(substr(tmp,4,1))=49) +
(asc(substr(tmp,5,1))=49))
#end
#declare V1 = 0;
#declare V2 = <1,2>;
#declare V3 = <3,4,5>;
#declare V4 = <3,4,5,6>;
#declare V5 = <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),
"\nSize of V4: ", str(VectorSize(V4),0,0),
"\nSize of V5: ", str(VectorSize(V5),0,0), "\n")
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|