POV-Ray : Newsgroups : povray.general : sphere sweep - possible bug with b_spline Server Time
4 Aug 2024 16:13:28 EDT (-0400)
  sphere sweep - possible bug with b_spline (Message 1 to 6 of 6)  
From: Brendt Hess
Subject: sphere sweep - possible bug with b_spline
Date: 11 Apr 2003 02:50:06
Message: <3E96659F.3070700@attbi.com>
I was doing some POV 'sketching' (basically, drawing some outlines and 
points that I know I will need, with the intention of filling in the 
rest later).  For one section, I decided to use a sphere_sweep, starting 
and ending on two previously marked points.

When I placed in those sweeps, and did a quick test render, I was caught 
by surprise... the ends of the sweeps did not coincide with the 
previously plotted points!

After some head scratching, as a test, I changed from a b_spline to a 
cubic_spline in the sweep.... and the endpoints were exactly where I 
would have expected them to be.

Now... is this a documentation imprecision, a misunderstanding on my 
part as to how the b_spline sweep works, or a bug?

Below is a snippet of the code used.  This reproduces the error on my 
system (Athlon 850, Win98se, 256Mb RAM, POV3.5)

---------------------------------------------

#include "colors.inc"
// Command Line Switches:  FN +W800 +H800 +UA +AM2 +A0.2
// If the Width is <>
camera {
         location <0,0,-15.1>
         right x
         up y
         look_at <0,0,0>
         }

light_source {  <-9,8,-40> rgb<1,1,1>*1.5 shadowless area_light x*7, 
y*6, 3,3 }

#declare topy=2*1.618;
#declare rightx=2;
#declare Point = sphere {0,0.1 pigment { color Yellow }}

object {Point translate <rightx, topy,0>}
object {Point translate <-rightx, topy,0>}
object {Point translate <rightx * 0.725, topy * 1.09,0>}
object {Point translate <rightx * 0.45, topy * 1.14,0>}
object {Point translate <rightx * 0.175, topy * 1.1618,0>}
object {Point translate <-rightx * 0.725, topy * 1.09,0>}
object {Point translate <-rightx * 0.45, topy * 1.14,0>}
object {Point translate <-rightx * 0.175, topy * 1.1618,0>}

object {Point translate <-rightx, -topy,0>}
object {Point translate <rightx, -topy,0>}
object {Point translate <rightx * 0.725, topy * -1.09,0>}
object {Point translate <rightx * 0.45, topy * -1.14,0>}
object {Point translate <rightx * 0.175, topy * -1.1618,0>}
object {Point translate <-rightx * 0.725, topy * -1.09,0>}
object {Point translate <-rightx * 0.45, topy * -1.14,0>}
object {Point translate <-rightx * 0.175, topy * -1.1618,0>}

#declare Side=sphere_sweep {b_spline 7,
                 <rightx* 1.38, topy * 2, 0>, 0.1,
                 <rightx, topy, 0>, 0.1,
                 <rightx/1.38, topy * 0.5, 0>, 0.1,
                 <rightx/1.618, 0, 0>, 0.1,
                 <rightx/1.38, -topy * 0.5, 0>, 0.1,
                 <rightx, -topy, 0>, 0.1,
                 <rightx* 1.38, -topy * 2, 0>, 0.1
                 pigment { color Brown }
                 }
Side
object {Side rotate y*180}
------------------------------------------------------------


Post a reply to this message

From: ABX
Subject: Re: sphere sweep - possible bug with b_spline
Date: 11 Apr 2003 03:26:04
Message: <3qqc9v4t8u0gmoafqkshe1876koosg6oi5@4ax.com>
On Thu, 10 Apr 2003 23:50:07 -0700, Brendt Hess <bre### [at] attbicom> wrote:
> When I placed in those sweeps, and did a quick test render, I was caught 
> by surprise... the ends of the sweeps did not coincide with the 
> previously plotted points!

http://www.povray.org/documentation/view/15/

As it is stated there only linera_spline is ineterpolation. b_spline and
cubic_spline is aproximation. The property of interpolation is that if you have
contol point given for some t parameter then

  Interpolation( t ) = Control_Point( t )

while in aproximation

  Interpolation( t ) <> Control_Point( t )

(Or perhaps I misunderstand your problem)

ABX


Post a reply to this message

From: ABX
Subject: Re: sphere sweep - possible bug with b_spline
Date: 11 Apr 2003 03:30:07
Message: <pkrc9vk0ekevu83i16pets3jkkcp1co65o@4ax.com>
On Fri, 11 Apr 2003 09:25:00 +0200, ABX <abx### [at] abxartpl> wrote:
>  Interpolation( t ) <> Control_Point( t )

or rather 

  Interpolation( t ) can be <> Control_Point( t )

ABX


Post a reply to this message

From: Mark Weyer
Subject: Re: sphere sweep - possible bug with b_spline
Date: 11 Apr 2003 04:29:30
Message: <3E967231.4090703@informatik.uni-freiburg.de>
> As it is stated there only linera_spline is ineterpolation. b_spline and
> cubic_spline is aproximation.

To my knowledge cubic splines do have the interpolation property.
For four points p1 to p4 the cubic spline is a third order polynomial
curve that goes through p2 and p3 such that the tangent at p2 is
parallel to the line p1p3 and the tangent at p3 is parallel to the
line p2p4. A b-spline is also a third order polynomial curve, but it
does not go through p2 and p3. It is optimized to go as near p2 and p3
as smoothness allowes, but I don't know exactly.
For more points p1 to pn both splines are the concatenation of the
respective splines for p1 to p4, p2 to p5,..., and p(n-3) to pn.


-- 
merge{#local i=-11;#while(i<11)#local
i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
pigment{rgbt 1}interior{media{emission x}}hollow}//  Mark Weyer


Post a reply to this message

From: ABX
Subject: Re: sphere sweep - possible bug with b_spline
Date: 11 Apr 2003 04:48:12
Message: <710d9v0setvc1rf97i0k1v2rbfcrmorv9q@4ax.com>
On Fri, 11 Apr 2003 09:43:45 +0200, Mark Weyer
<wey### [at] informatikuni-freiburgde> wrote:
> > As it is stated there only linera_spline is ineterpolation. b_spline and
> > cubic_spline is aproximation.
>
> To my knowledge cubic splines do have the interpolation property.

The problem is that cubic spline name seems applied to whole family of curves. I
do not remember exact implementation in sphere_sweep but indeed usually it goes
through endpoints so it can be interpolation as well.

ABX


Post a reply to this message

From: Brendt Hess
Subject: Re: sphere sweep - possible bug with b_spline
Date: 11 Apr 2003 11:35:33
Message: <3e96e0c5@news.povray.org>
ABX wrote:
> On Thu, 10 Apr 2003 23:50:07 -0700, Brendt Hess <bre### [at] attbicom> wrote:
> 
>>When I placed in those sweeps, and did a quick test render, I was caught 
>>by surprise... the ends of the sweeps did not coincide with the 
>>previously plotted points!
> 
> As it is stated there only linera_spline is ineterpolation. b_spline and
> cubic_spline is aproximation. The property of interpolation is that if you have
> contol point given for some t parameter then
> 
>   Interpolation( t ) = Control_Point( t )
> 
> while in aproximation
> 
>   Interpolation( t ) <> Control_Point( t )
> 
> (Or perhaps I misunderstand your problem)
> 

No, you understand the problem.  I read that, but interpreted the 
paragraph differently, at least for the spline endpoints.  However, 
looking again this morning, I found this piece of documentation:

http://www.povray.org/documentation/view/51/#s03_04_04

"When using a b_spline, the resulting object is somewhat similar to the 
cubic sweep, but doesn't actually go through the control points. It lies 
somewhere between them."

With this, I now understand.  Of course, this is particularly hard to 
find in the documentation... mostly because hitting F1 while on the 
b_spline keyword takes you to section 6.5.1.10, which does not explaing 
this bit about the splines.  This is in section 3.4.4 only.

(Sec. 3.4.4 also notes that a Cubic spline passes through the control 
points.)  I'm still a bit surprised about the degree of imprecision on 
the endpoints (about +/-.25 Y units beyond the theoretical endpoints, 
with the X value precise).  Examining it, I guess that the decision 
about where the endpoint actually falls is something like when the X, Y, 
and Z values are all >= the designated control point location.  Hmmm... 
let's see if I can test that... Nope... the difference appears to be 
solely constrained by the distabce between the first and second control 
points.

For example, using my previous sample, the final point plotted is +/- 
.25y.  Changing the first control point's Y position to topy+22 places 
the end of the sweep off of the screen.  Pulling the camera back, the 
end looks to be about 9 or ten units +y.

Odd... perhaps this should be placed as an example in the documents 
(simplified, of course).  At least section 6.5.1.10 should reference 
3.4.4 for information about the spline types.


Post a reply to this message

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