POV-Ray : Newsgroups : povray.beta-test : wrong interpolation at start of spline Server Time
30 Jul 2024 16:18:50 EDT (-0400)
  wrong interpolation at start of spline (Message 1 to 5 of 5)  
From: ingo
Subject: wrong interpolation at start of spline
Date: 24 Oct 2001 07:19:55
Message: <Xns9144879EE9E47seed7@povray.org>
From the scene below the expected result is a square, yet I get a 
thing like:
 ____
|    |
|  \ |
|   \|

 When the first point of the spline is omitted, the result is a square. 
I.M.O the first point should be of no influence when using a 
linear_spline.
 When using a quadratic or cubic spline something simmiliar happens, 
with the first point the shape is not closed. Without the first point 
the shape is closed, but not smooth at the point where it closes.

---%<------%<---
#version 3.5;
global_settings {assumed_gamma 1.0}
camera {
  location  <0.5,0.5,-2>
  look_at   <0.5,0.5, 0>
}

#declare Spl=spline{
   -0.25,<0,1,0>,
    0,   <0,0,0>,
    0.25,<1,0,0>,
    0.50,<1,1,0>,
    0.75,<0,1,0>,
    1,   <0,0,0>,
    1.25,<1,0,0>,
}

#declare I=0;
#declare N=100;
#while(I<=N)
   sphere{
      Spl(I/N, linear_spline),0.05
      pigment{rgb 1} 
      finish{ambient 1}
   }
   #declare I=I+1;
#end
---%<------%<---

PII 233MHz 192MB NT4 SP6 POV-Ray 3.5-b6

Ingo

-- 
Photography: http://members.home.nl/ingoogni/
Pov-Ray    : http://members.home.nl/seed7/


Post a reply to this message

From: Bob H 
Subject: Re: wrong interpolation at start of spline
Date: 24 Oct 2001 10:33:13
Message: <3bd6d129@news.povray.org>
"ingo" <ing### [at] homenl> wrote in message
news:Xns### [at] povrayorg...
> From the scene below the expected result is a square, yet I get a
> thing like:
>  ____
> |    |
> |  \ |
> |   \|
>
>  When the first point of the spline is omitted, the result is a square.
> I.M.O the first point should be of no influence when using a
> linear_spline.
>  When using a quadratic or cubic spline something simmiliar happens,
> with the first point the shape is not closed. Without the first point
> the shape is closed, but not smooth at the point where it closes.

I don't know splines too well but seems strange to me that leaving off both
the first and last points close the loop although adding them opens it.  I
thought cubic and quadratic required the control or anchor points, which in
this case are the T=-0.25 and T=1.25 here.
For linear, you can see that the points beyond T=0 through T=1 are ignored.
Well, except if I=-25 then the first is seen, but N=125 or 150 doesn't show
the last T value.  If you get what I'm saying.

Bob H.


Post a reply to this message

From: Mike Williams
Subject: Re: wrong interpolation at start of spline
Date: 24 Oct 2001 14:51:44
Message: <9ClktIAGzw17Ewa+@econym.demon.co.uk>
Wasn't it ingo who wrote:
> From the scene below the expected result is a square, yet I get a 
>thing like:
> ____
>|    |
>|  \ |
>|   \|
>
> When the first point of the spline is omitted, the result is a square. 
>I.M.O the first point should be of no influence when using a 
>linear_spline.
> When using a quadratic or cubic spline something simmiliar happens, 
>with the first point the shape is not closed. Without the first point 
>the shape is closed, but not smooth at the point where it closes.

The bug with splines that have 0 as a control value isn't fixed yet.

The workaround is to change your "0" control point into a small non-zero
value, like

#declare Spl=spline{
   -0.25,<0,1,0>,
    0.001,<0,0,0>, // instead of 0,<0,0,0>
    0.25,<1,0,0>,
    0.50,<1,1,0>,
    0.75,<0,1,0>,
    1,   <0,0,0>,
    1.25,<1,0,0>,
}

Which produces the square correctly.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Mark Wagner
Subject: Re: wrong interpolation at start of spline
Date: 25 Oct 2001 01:01:30
Message: <3bd79caa$1@news.povray.org>
ingo wrote in message ...
> From the scene below the expected result is a square, yet I get a
>thing like:
> ____
>|    |
>|  \ |
>|   \|
>
> When the first point of the spline is omitted, the result is a square.
>I.M.O the first point should be of no influence when using a
>linear_spline.


Slightly more detailed version of the usual reply follows:
As usual, I can't reproduce this bug with my development version of POV-Ray.
I can reproduce it with POV 3.5 beta 6.
However, the reason for the bug occurring is beyond me: I just finished
comparing the spline source code for my development version, and the spline
source code for the official version, and they are virtually identical.
There are no differences that would be causing this problem.

--
Mark


Post a reply to this message

From: Mark Wagner
Subject: Re: wrong interpolation at start of spline
Date: 25 Oct 2001 01:05:45
Message: <3bd79da9@news.povray.org>
Bob H. wrote in message <3bd6d129@news.povray.org>...
> but N=125 or 150 doesn't show
>the last T value.  If you get what I'm saying.

That's because of how the T value for evaluation is computed: Spl(I/N,
linear_spline).  No matter how big you make N, the spline will always be
evaluated from I/N to N/N, or in other words, to 1.  If you change the code
to Spl(I/100, linear_spline), and #declare I = -25, #declare N = 125, both
end points show up properly.

--
Mark


Post a reply to this message

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