POV-Ray : Newsgroups : povray.advanced-users : subtle behavior of Spline_Trans() macro in transforms.inc : Re: subtle behavior of Spline_Trans() macro in transforms.inc Server Time
3 Jul 2024 04:33:32 EDT (-0400)
  Re: subtle behavior of Spline_Trans() macro in transforms.inc  
From: Warp
Date: 19 Apr 2009 16:57:45
Message: <49eb9049@news.povray.org>
Kenneth <kdw### [at] earthlinknet> wrote:
> IMHO--and in an ideal world-- the code should be rewritten to be more elegant
> and 'all-inclusive,' so to speak--so that a value of zero IS exact alignment.

  The value of zero is not exact alignment because a vector of zero size
has no direction. (In practice what you get is a division by zero when
trying to normalize the vector or reorient anything using that vector).

  Two points on the spline gives you an approximation of the direction of
the spline (which is what is used here). The closer the points are to each
other, the more accurate the direction will be. Of course one could hastily
think that you should then use something like 1e-100 as the distance between
the two points to get a very very very accurate direction. However, the
drawback of using two points which are too close to each other is that you
start losing accuracy (due to the limited size of floating point numbers).
Thus using a distance of 1e-100 is not a good idea, as you will most probably
get a larger error than with eg. a distance of 1e-10.

  It is possible in mathematics to calculate the *exact* direction of a
spline, but to do that you need the three partial derivatives of the
spline function at the desired point (and then you can use these three
derivative functions to calculate the accurate direction vector).

  If you really want, you can try that (but first you will need to know
the exact spline function used by POV-Ray, and then you'll have to calculate
its three partial derivatives). However, I doubt you will get any significant
improvement in accuracy compared to the current approximation method using
two points on the spline (due to the limited accuracy of floating point
numbers).

-- 
                                                          - Warp


Post a reply to this message

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