POV-Ray : Newsgroups : povray.binaries.utilities : Polynomial Spreadsheet : Re: Polynomial Spreadsheet Server Time
16 Apr 2024 19:09:55 EDT (-0400)
  Re: Polynomial Spreadsheet  
From: Bald Eagle
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

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