POV-Ray : Newsgroups : povray.programming : Faster quartics? : Faster quartics? Server Time
14 Jun 2024 12:09:12 EDT (-0400)
  Faster quartics?  
From: IanM
Date: 7 Sep 2005 05:50:01
Message: <web.431eb75b5ea16387798d3730@news.povray.org>
Hi guys:

Sorry if this an already known issue: I did my best to find a reference to
it in the newsgroups, but found nothing.

This could be a nice way to accelerate rendering of quartic surfaces
(including tori, and this means a better world for H. Simpson). When you
use the analytical solver instead of the Sturm solver, no matter what exact
method you use, you need to solve an auxiliary cubic equation. A cubic
equation always has one or three roots... and as far as I know, it doesn't
matters which root you use, so you could always use the first root.

The quartic solver, instead, solves cubic equations via the general cubic
solver. It means that, in a great number of cases, the cubic solver will
have to compute two innecesary roots... and worse, this implies two
unnecesary calls to trascendental functions and a couple of floating point
divisions. This makes room for further optimizations, if you add an
additional specialized cubic solver for this special case. For instance,
the multiplier for the cubic term is always 1.0. You don't need to supply
an array to receive any roots, so you end up with a very simple prototype:

  // Sorry :), this is simplified C# syntax
  double Special3Solver(double a2, double a3, double a4) { }

I have test this change in a highly simplified C# ray tracing prototype...
and it pays. Since I'm not an expert in floating point operations, I'm not
sure whether this change could have any implications on precision (but it
seems it won't). Even in that case, I would check the performance of an
additional iteration of the Newton-Horner method to enhance the solution.
Since the original root would be very near to the exact root, I think this
could be faster than a raw Sturm solver.

Am I missing something?

Regards,

Ian


Post a reply to this message

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