|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hello,
what is shourtcut function for max(a,min(b,x)) ?
btw. how about adding function
limit1(a)
that will work as max(0,min(1,x))
ofcourse this can be done with macro - but hard-coded function will be
faster, and this construcion is quite frequent in i.e. patterns
--
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
There is no shortcut afaik.
Just use
#declare limit1= function(a) {max(0,min(1,a))}
or somethink like that.
Feel free to add this to your "functions.inc" or some other include-file you
are using frequently. There is really no need to build in everythink in the
Pov-Code.
Hth,
Marc-Hendrik
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Marc-Hendrik Bremer" <Mar### [at] t-onlinede> wrote in
news:3d9aec64@news.povray.org
> There is really no need to build in everythink in the
> Pov-Code.
speed ?
We have i.e. 1 room (inverted box) inside with we have camera, lightsource
and i.e. white sphere.
Box is covered with function with 1-3 constructions like
max(0,min(1,x+y...))
And now we add radiosity - fo reach pixel formula min(max(... must be
counted about 10..50 times depending on radiosity setting - that can
probably give 5-15% of render time lost. Hmm I guess I should just add this
minmax() function and see is speed improvment notacible :)
--
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
There's a clip() function in math.inc, if that's what you are talking
about.
--
#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 <war### [at] tagpovrayorg> wrote in news:3d9afc31@news.povray.org
> There's a clip() function in math.inc, if that's what you are talking
> about.
thanks
Just for couriosity I will modify it's code to work as
clip(0,1,x) (change variables to literal constants 0 and 1 should improve
speed a little bit) - in with file should I look ? (maybe function name ?)
--
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Rafal 'Raf256' Maj <raf### [at] raf256com> wrote:
> Just for couriosity I will modify it's code to work as
> clip(0,1,x)
Why don't you just make another function which does that instead of
modifying the standard function?
Modifying the standard function is very dangerous, as it will potentially
break some scenes you might download.
> in with file should I look ?
I said "math.inc", didn't I?
--
#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 <war### [at] tagpovrayorg> wrote in news:3d9b0160@news.povray.org
>> Just for couriosity I will modify it's code to work as
>> clip(0,1,x)
> Why don't you just make another function which does that instead of
> modifying the standard function?
just for a moment, before I learn how to add own function to syntax parser
>> in with file should I look ?
> I said "math.inc", didn't I?
source code
--
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Rafal 'Raf256' Maj <raf### [at] raf256com> wrote:
>> I said "math.inc", didn't I?
> source code
It will be hard to modify the clip() function in the source code, as
it's in defined in math.inc, not in the source code. :)
--
#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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp <war### [at] tagpovrayorg> wrote in news:3d9b06f0@news.povray.org
>> source code
> It will be hard to modify the clip() function in the source code, as
> it's in defined in math.inc, not in the source code. :)
#declare clip = function (V, Mn, Mx) {min(Mx, max(V, Mn))}
woooow... this must be terrible slow in compare to hard-coded function.
With function takes 3 float argumetns, return float and is a real function
(not #decare/#macro) ?
--
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Rafal 'Raf256' Maj <raf### [at] raf256com> wrote:
> #declare clip = function (V, Mn, Mx) {min(Mx, max(V, Mn))}
> woooow... this must be terrible slow in compare to hard-coded function.
Do you want me to preach again about the advantages of using a macro or
function compared to a hard-coded feature?
I can't imagine a scene where the speed-difference would be noticeable.
(Of course you could invent rather artificial examples, but I'm talking
about practical scenes.)
--
#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
|
|
| |
| |
|
|
|
|
| |
|
|