POV-Ray : Newsgroups : povray.advanced-users : Adding forces to points in curves : Re: Adding forces to points in curves Server Time
30 Jul 2024 12:23:35 EDT (-0400)
  Re: Adding forces to points in curves  
From: Chris Colefax
Date: 30 Dec 1999 21:56:38
Message: <386c1b66@news.povray.org>
Rune <run### [at] inamecom> wrote:
> I'll use Mike Williams' + Peter Popov's methods, but now with your
> suggestion I'll give my original idea another try as well. I'll then see
> which works best.

As I mentioned in the previous thread (Optimised curves) cubic splines will
not give you the circular curves you posted in .images, although you may
find you prefer cubic splines anyway!

> I understand you so far, i.e. how to find out how much the curve is bended
> on a given point.
> However, to me the problem is how to straighten out the curve. I mean, I
can
> see that I want to get the cosine of the angle as close as possible to -1,
> but it is how to accomplish this that is the problem.
>
> Has you any ideas as to how to accomplish it?

One way might be to move the third point closer to the line that is formed
by the first and second points, eg. given P1, P2, and P3 (the point to be
moved):

   P3 = P3*W1 + (P2 + P2 - P1)*W2;

Here W1 and W2 are the weights you are giving to the current point versus
the point that would be if there was no bending at all.   They should add to
1, and you could determine the weights using a function of the previously
calculated cosine (C), eg:

   W1 = (1 - C)/2;
   W2 = 1 - W1;

Here a cosine of -1 (180 degrees) gives full weighting to the current point
and zero weighting to the desired point (which are actually one and the same
so the weights don't matter).  A cosine of 1 (0 degrees) gives the
opposite - full weighting to the desired point and none to the current point
(in effect flipping the current point around 180 degrees).  In between, the
closer the cosine is to -1 (180 degrees) the less the point is moved, eg. a
cosine of 0 (90 degrees) gives equal weighting to each point so the new
point is about 45 degrees from the desired point.  Adjusting the way the
weights are calculated will obviously affect the 'unkinking' of the links.


Post a reply to this message

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