POV-Ray : Newsgroups : povray.binaries.scene-files : A poly 16 file for Le_Forgeron : Re: A poly 16 file for Le_Forgeron Server Time
6 May 2024 19:10:47 EDT (-0400)
  Re: A poly 16 file for Le_Forgeron  
From: Jaap Frank
Date: 16 Dec 2010 16:52:02
Message: <4d0a8a02$1@news.povray.org>
>"Le_Forgeron"  schreef in bericht news:4d0a5fa2@news.povray.org... 
>
>Le 16/12/2010 02:14, Jaap Frank nous fit lire :
>> I've ask in the Povray Bug Tracking System to raise the maxpower of the
>> poly object with one power to 16.
> >Le_Forgeron asked me for a genuine poly 16 file to test the system. It's
> >attached to this post.
>
>There is a syntax error on line 318. Can you fix it (just post the
>corrected line) ?
>
>/*  x^6.y^2.z^4   */   ,
>-12*T6*P4*R4-48*T4*P2*R2*(5*R2+A2)-40*T2*(R2-A2)*R2+3*A2)
>
>Notice the closing parenthesis with no opening.


-12*T6*P4*R4-48*T4*P2*R2*(5*R2+A2)-40*T2*(R2-A2)*(R2+3*A2)

The opening parenthesis is just before the last R2 > > > >  ^
In case I forgot an other one, all the factors look alike and have a
R2 and an A2 between the parenthesis and no other variables. 
A few times there is a (R4 -A4).


>So far I just tried to raise the limit (easily)... but it render only a
>yellow stone and black sky.


Did you take a look at the poly8 file? It should give the same result.
I can't guarantee that the poly 16 formula is correct, but the result 
looks oke.

>I might take more time than expected if I have to found an actual
>surface. (oh, well, I might provide a new syntax as well... it's too
>late for 3.7 anyway). At least your demo scene confirmed me that a lot
>of values are 0.
>
>You are right about the code of binomial(): it is dead. (the array is
>used all the time, due to the parser limiting the order)
>In fact it is silly computing the binomial coefficient by the absolute
>formula b(k,r) = k!/((k-r)! * r!), using optimisation of factoring the
>numbers in stacks and removing common parts, to avoid big numbers.
>It is also silly, because it try to factor for all odd numbers instead
>of just primes. What a waste of modulo computation.
>
>It is far simpler to know that it's the pascal's triangle, with
>b(k,r)=b(k-1,r-1)+b(k-1,r) when r>0 and r<k;
>b(k,0)=1 as well as b(k,k)=1.
>
>Must have been some "smart" coding of that old time.

When I searched my old stuf I found a manual for POV 0.5 beta,
together with one for POV-Ray 1.0gw (27 april 1992). There were
no poly objects in those times. I think they were introduced in version 2
or maybe stil later in version 3. That would make the code at least 
15 years old. 
But you are right, the Triangle of Pascal is far more simpler. I always
used the triangle to show the beauty of mathematics to students who
found mathematics dull and to difficult. They were always amazed
they could write out (a+b)^7 in a few moments and sometimes began
to like mathematics a bit because of that.
I would say, keep the hard code until pow 16 and use your way to 
expand it if necessary.
>
>32 bits unsigned int can store down to depth 35.
>64 bits go down to depth 69.

Is it possible that high powers gives problems with the minimum (or
maximum) values that can be used. Values of 0.001 for x,y or z are 
quit normal, but raised to power 16 you already get 1E-48. It may be 
the reason for limiting to maxpower 15 in the past.
If that's a problem, stick to maxpower 16 then.

Thanks for reacting to my request.

Jaap Frank


Post a reply to this message

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