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 05:12:25 EDT (-0400)
  Re: subtle behavior of Spline_Trans() macro in transforms.inc  
From: Warp
Date: 20 Apr 2009 05:35:15
Message: <49ec41d3@news.povray.org>
clipka <nomail@nomail> wrote:
> Warp <war### [at] tagpovrayorg> wrote:
> > > Really? Can a macro in POV SDL calculate the exact mathematical derivative
> > > of a function?  I didn't know that.
> >
> >   Can a macro calculate points on a spline?
> >
> >   It's simply a question of creating the macro. I don't see the problem.

> Ah, yes? Then go ahead and present your solution, Mr. Smart... pure POV-Ray SDL,
> please.

  I don't have the motivation to study exactly which mathematical function
POV-Ray is using for its splines nor calculating its derivatives.

  I don't see the problem you are having. A derivative function is nothing
more than a function. In the exact same way as you can create a macro which
returns values of a function, you can create another macro which returns
values of its derivative function. Because it's just another function.

  If you tell me that the derivative of the spline function can *not* be
calculated because it's one of those functions without a derivative, then
that may be plausible (although you would have to explain why that is so).
However, you write as if creating a macro which returns a vector based on
a derivative function is impossible. I just can't understand what is the
problem you are seeing there.

  Suppose we had the 1-dimensional function x^2 and we wanted to create a
macro which returns the tangent vector at a given point in that function.
Since we know that the derivative of x^2 is 2*x, that's rather trivial to do:

#macro OriginalFunction(X) X*X #end

#macro DirectionAt(X) <1, 2*X> #end

  It's the same thing for the spline, but a bitmore complicated (because
a spline is a 3-dimensional function rather than a 1-dimensional one and
thus you need the three partial derivatives).

-- 
                                                          - Warp


Post a reply to this message

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