POV-Ray : Newsgroups : povray.binaries.utilities : Polynomial Spreadsheet Server Time
7 Dec 2021 04:09:36 EST (-0500)
  Polynomial Spreadsheet (Message 11 to 12 of 12)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Bald Eagle
Subject: Re: Polynomial Spreadsheet
Date: 23 Oct 2017 12:55:08
Message: <web.59ee1ec263d226a5c437ac910@news.povray.org>
So, the idea is that you can just plug in values for the exponents in the
applicable terms, and the top cells with have a correctly formatted syntax for
the poly{} object:

poly {4, <9, r2*r2, 1, -123, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, constant>}

or the polynomial {} object with the 'easy' syntax:

polynomial {xyz(4,0,0):9, xyz(3,1,0):r2*r2, xyz(3,0,1):1, xyz(3,0,0):-123,
xyz(2,2,0):1, xyz(2,1,1):1, xyz(2,1,0):1, xyz(2,0,2):1, xyz(2,0,1):1,
xyz(2,0,0):1, xyz(1,3,0):1, xyz(1,2,1):1, xyz(1,2,0):1, xyz(1,1,2):1,
xyz(1,1,1):1, xyz(1,1,0):1, xyz(1,0,3):1, xyz(1,0,2):1, xyz(1,0,1):1,
xyz(1,0,0):1, xyz(0,4,0):1, xyz(0,3,1):1, xyz(0,3,0):1, xyz(0,2,2):1,
xyz(0,2,1):1, xyz(0,2,0):1, xyz(0,1,3):1, xyz(0,1,2):1, xyz(0,1,1):1,
xyz(0,1,0):1, xyz(0,0,4):1, xyz(0,0,3):1, xyz(0,0,2):1, xyz(0,0,1):1,
xyz(0,0,0):constant}

or if you wanted to use the equation in a function, for an isosurface, then
that's available too:

#declare Polynomial = function {(9 * pow(x,4)) + (r2*r2 * pow(x,3) * y) +
(pow(x,3) * z) + (-123 * pow(x,3)) + (pow(x,2) * pow(y,2)) + (pow(x,2) * y * z)
+ (pow(x,2) * y) + (pow(x,2) * pow(z,2)) + (pow(x,2) * z) + (pow(x,2)) + (x *
pow(y,3)) + (x * pow(y,2) * z) + (x * pow(y,2)) + (x * y * pow(z,2)) + (x * y *
z) + (x * y) + (x * pow(z,3)) + (x * pow(z,2)) + (x * z) + (x) + (pow(y,4)) +
(pow(y,3) * z) + (pow(y,3)) + (pow(y,2) * pow(z,2)) + (pow(y,2) * z) +
(pow(y,2)) + (y * pow(z,3)) + (y * pow(z,2)) + (y * z) + (y) + (pow(z,4)) +
(pow(z,3)) + (pow(z,2)) + (z) + constant}

and all you have to do is copy and paste whichever syntax you want.

In the above examples, obviously r2 and constant need to be previously defined
variable names in your scene.


Post a reply to this message

From: Bald Eagle
Subject: Re: Polynomial Spreadsheet
Date: 24 Oct 2017 20:25:00
Message: <web.59efd8cb63d226a55cafe28e0@news.povray.org>
"B. Gimeno" <nomail@nomail> wrote:
According to the documentation, the
> polynomial version of the syntax lacks the "command" parameter at first so that
> the program starts processing.

I checked out the results using the data for the torus in the docs, and I think
I see what you mean.  polynomial {} requires the order of the equation followed
by the rest of the data.  I made the edit, and it should work fine now. [version
1.0a]


> From the "function" version I lack experience to
> know why it also gets stuck in the calculation. Greetings, and thank you for
> sharing.
>
> B. Gimeno

I'm not sure what you mean by "stuck" - does POV-Ray give you an error?
I had no problems when I copied and pasted the function into a scene:

#declare Polynomial = function {(pow(x,4)) + (2 * pow(x,2) * pow(y,2)) + (2 *
pow(x,2) * pow(z,2)) + (-104 * pow(x,2)) + (pow(y,4)) + (2 * pow(y,2) *
pow(z,2)) + (56 * pow(y,2)) + (pow(z,4)) + (-104 * pow(z,2)) + 784}

and then used that function in an isosurface:

isosurface {
 function {Polynomial (x, y, z)}
 accuracy 0.001
 max_gradient 4510
  contained_by {box {<-10, -4, -10>, <10, 4, 10>} }
  texture {pigment {DocPigment} finish {specular 0.2}}
} // end isosurface



I may see if I can work out some more refinements to make it a little easier to
use.  I could highlight the terms that need values (if they are non-zero) so
that it's easier to find the terms to edit.  There might also be a way for me to
consolidate the list of terms depending on the order - but that might take quite
a bit of tinkering.


Post a reply to this message


Attachments:
Download 'polynomial 1.0a.ods.dat' (47 KB)

<<< Previous 10 Messages Goto Initial 10 Messages

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