POV-Ray : Newsgroups : povray.advanced-users : Order-8 Polys, and Beyond Server Time
25 Nov 2024 23:42:57 EST (-0500)
  Order-8 Polys, and Beyond (Message 1 to 9 of 9)  
From: Bryan Elwood
Subject: Order-8 Polys, and Beyond
Date: 4 Dec 2001 15:36:33
Message: <3c0d33d1$1@news.povray.org>
Hi Group,

Has anyone had any success rendering a Poly of order-8, or greater?  The
help file says order-7 is the maximum.  I have been reading a piece of
literature that talks about using a ray tracer to graph high-order
polynomials.

Thanks for any help,
--
Bryan Elwood
bel### [at] airmailnet
Cut my grass if replying by e-mail.


Post a reply to this message

From: Warp
Subject: Re: Order-8 Polys, and Beyond
Date: 4 Dec 2001 16:00:25
Message: <3c0d3968@news.povray.org>
Bryan Elwood <bel### [at] airmailnet> wrote:
: Has anyone had any success rendering a Poly of order-8, or greater?

  Use isosurfaces. The syntax is easier as well.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: Mark Wagner
Subject: Re: Order-8 Polys, and Beyond
Date: 5 Dec 2001 01:41:15
Message: <3c0dc18b@news.povray.org>
Bryan Elwood wrote in message <3c0d33d1$1@news.povray.org>...
>Hi Group,
>
>Has anyone had any success rendering a Poly of order-8, or greater?  The
>help file says order-7 is the maximum.  I have been reading a piece of
>literature that talks about using a ray tracer to graph high-order
>polynomials.


If I've read the POV-Ray source code right, the "poly" object supports
polynomials up to order 15.  You'll have to figure out the order for the
coefficients yourself, though, as the manual only presents it up to order 7.
Additionally, I'm not sure how effective the root finder will be with
high-order polynomials.

--
Mark


Post a reply to this message

From: Bryan Elwood
Subject: Re: Order-8 Polys, and Beyond
Date: 5 Dec 2001 02:14:16
Message: <3c0dc948@news.povray.org>
"Mark Wagner"  wrote:
> You'll have to figure out the order for the
> coefficients yourself...

Thanks Mark,

I used Poly2Pov to get the coefficients automatically.  I actually shot my
first "octic" after posting.  It did render, but it was extremely speckled.

> I'm not sure how effective the root finder
> will be with high-order polynomials.

Not very good.  And I explicitly called the Sturmian root solver, even
though it's automatic for higher orders.

I wonder if there is a way to get the developers to tune this up.  I would
sacrifice speed for accuracy.

--
Bryan Elwood
bel### [at] airmailnet
Cut my grass if replying by e-mail.


Post a reply to this message

From: Bryan Elwood
Subject: Re: Order-8 Polys, and Beyond
Date: 5 Dec 2001 02:26:43
Message: <3c0dcc33@news.povray.org>
Thanks for the suggestion Warp.

--
Bryan Elwood
bel### [at] airmailnet
Cut my grass if replying by e-mail.

"Warp" <war### [at] tagpovrayorg> wrote:
>   Use isosurfaces. The syntax is easier as well.


Post a reply to this message

From: Warp
Subject: Re: Order-8 Polys, and Beyond
Date: 5 Dec 2001 09:30:39
Message: <3c0e2f8e@news.povray.org>
Bryan Elwood <bel### [at] airmailnet> wrote:
: I wonder if there is a way to get the developers to tune this up.  I would
: sacrifice speed for accuracy.

  Repeat after me: Isosurfaces.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: Bryan Elwood
Subject: Re: Order-8 Polys, and Beyond
Date: 5 Dec 2001 11:10:02
Message: <3c0e46da$1@news.povray.org>
But, but, but...  I laid down POV-Ray back in V2.2.  This means I'll have to
learn new stuff. :-)

Actually Warp, I printed the Isosurface help topic yesterday so that I could
begin experimenting.  Currently, I'm just more comfortable talking about
polynomial surfaces.  But you make it sound like isosurfaces are my answer
just waiting for me to discover.

Thanks again,
--
Bryan Elwood
bel### [at] airmailnet
Cut my grass if replying by e-mail.


"Warp" <war### [at] tagpovrayorg> wrote:
>   Repeat after me: Isosurfaces.


Post a reply to this message

From: Warp
Subject: Re: Order-8 Polys, and Beyond
Date: 5 Dec 2001 15:11:50
Message: <3c0e7f86@news.povray.org>
Bryan Elwood <bel### [at] airmailnet> wrote:
: Actually Warp, I printed the Isosurface help topic yesterday so that I could
: begin experimenting.  Currently, I'm just more comfortable talking about
: polynomial surfaces.  But you make it sound like isosurfaces are my answer
: just waiting for me to discover.

  Isosurfaces are incredibly versatile compared to polys. They are easier to
write, easier to read/understand, and often they even render faster than
equivalent polys(!).
  An example:

  A torus written with a poly looks like this:

#declare r1=1;
#declare r2=.5;
poly
{ 4,
  <1,0,0,0,2,
   0,0,2,0,-2*(r1*r1+r2*r2),
   0,0,0,0,0,
   0,0,0,0,0,
   1,0,0,2,0,
   2*(r1*r1-r2*r2),0,0,0,0,
   1,0,-2*(r1*r1+r2*r2),0,pow(r1,4)+pow(r2,4)-2*r1*r1*r2*r2>
}

  Writing the exact same polynomial as an isosurface looks like this:

#declare r1=1;
#declare r2=.5;
isosurface
{ function
  { x^4+2*x^2*y^2+2*x^2*z^2-2*(r1^2+r2^2)*x^2+y^4+2*y^2*z^2+2*(r1^2-r2^2)*y^2+
    z^4-2*(r1^2+r2^2)*z^2+(r1^2-r2^2)^2
  }
  contained_by { box { -<r1+r2, r2, r1+r2>, <r1+r2, r2, r1+r2> } }
  // Set accuracy and max_gradient as needed...
}

  Moreover, there is no need to write it in polynomial form. You can write
it a lot shorter and easier to read (and it will probably render faster as
well):

#declare r1=1;
#declare r2=.5;
isosurface
{ function
  { sqrt( (sqrt(x^2+z^2)-r1)^2 + y^2 ) - r2
  }
  contained_by { box { -<r1+r2, r2, r1+r2>, <r1+r2, r2, r1+r2> } }
  // Set accuracy and max_gradient as needed...
}


-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -



-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: Mark Wagner
Subject: Re: Order-8 Polys, and Beyond
Date: 6 Dec 2001 01:25:22
Message: <3c0f0f52@news.povray.org>
Bryan Elwood wrote in message <3c0dc948@news.povray.org>...
>I wonder if there is a way to get the developers to tune this up.  I would
>sacrifice speed for accuracy.


Yes.  It'll require compiling a custom version of POV-Ray.

By default, the root-finder iterates until either it gets "close enough" to
the root, or 50 iterations have been done.  For most polynomials under most
conditions, if the root finder hasn't found the root after 50 iterations,
it's close enough that the image will still look good.

On line 82 of the file "polysolv.c", it should say
#define MAX_ITERATIONS 50
To increase the maximum number of iterations of the root solver done, change
the 50 to whatever number you want, and then recompile POV-Ray.  I'd
recommend 500 or 1000 for starters.

--
Mark


Post a reply to this message

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