POV-Ray : Newsgroups : povray.beta-test : Twisted sp(l)ine Server Time
3 Nov 2024 05:20:03 EST (-0500)
  Twisted sp(l)ine (Message 1 to 4 of 4)  
From: David Wallace
Subject: Twisted sp(l)ine
Date: 26 Sep 2001 19:04:20
Message: <3BB25EFE.719F8B0E@earthlink.net>
I hope this is just a user screw-up, but I think it bears mentioning.
The spline calculations could well have some arcane bug.  Consider the
test code below:

light_source { < 24,7700, -515> color rgb 1 }

camera { location < -745, 87.0 ,  284> look_at < -400,  8.6 ,  0.0> }
// 4. Medium object snapshot

#declare spHull = spline {
 cubic_spline
 -0.03078, < 540, -10>
  0.0000 , < 546,   0>
  0.03078, < 540,  10>
  0.13960, < 500,  20>
  0.34574, < 440,  70>
  0.61716, < 340,  94>
  1.51453, <   0,  95>
  2.62304, <-420,  94>
  2.84308, <-500,  70>
  2.99278, <-540,  30>
  3.05180, <-520,  20>
  3.11081, <-540,  10>
  3.14159, <-546,   0>
  3.17237, <-540, -10>
  3.23139, <-520, -20>
  3.29041, <-540, -30>
  3.43971, <-500, -70>
  3.66015, <-420, -94>
  4.76866, <   0, -95>
  5.66602, < 340, -94>
  5.93745, < 440, -70>
  6.14358, < 500, -20>
  6.25241, < 540, -10>
  6.28319, < 546,   0>
  6.31396, < 540,  10>
}

#declare spHull2 = spline {
 cubic_spline
 -0.12303, < 488, -66>
  0.00000, < 525,   0>
  0.12303, < 488,  66>
  0.27318, < 400,  94>
  0.92358, <   0,  95>
  1.57397, <-400,  94>
  3.01856, <-488,  66>
  3.14159, <-525,   0>
  3.26462, <-488, -66>
  4.70921, <-400, -94>
  5.35961, <   0, -95>
  6.01000, < 400, -94>
  6.16016, < 488, -66>
  6.28319, < 525,   0>
  6.40621, < 488,  66>
}

#declare ip = 0;

#while (ip<2*pi)
 sphere { spHull(ip), 1 pigment { rgb <1, 1, 0> } }
 #declare ip = ip + .01;
#end

The code (as written) draws the outline of a shape similar to a Pac-Man
ghost, which is what I want.  The second spline, spHull2, is supposed to
draw something akin to an oval, but it draws weird curlicues near the
middle (where the parameter is pi).  I've been racking my brain trying
to find the error in my spline which causes this with no success.  So...
can you untwist the knot in my spline via the code, or is the spline
calculation in POV-Ray flawed?

POV-Ray 3.5b4, K6-II 400, 128MB, Win98SE


Post a reply to this message

From: Mark Wagner
Subject: Re: Twisted sp(l)ine
Date: 27 Sep 2001 00:21:25
Message: <3bb2a945@news.povray.org>
David Wallace wrote in message <3BB25EFE.719F8B0E@earthlink.net>...
>I hope this is just a user screw-up, but I think it bears mentioning.
>The spline calculations could well have some arcane bug.  Consider the
>test code below:


[code snipped]

>The code (as written) draws the outline of a shape similar to a Pac-Man
>ghost, which is what I want.  The second spline, spHull2, is supposed to
>draw something akin to an oval, but it draws weird curlicues near the
>middle (where the parameter is pi).  I've been racking my brain trying
>to find the error in my spline which causes this with no success.  So...
>can you untwist the knot in my spline via the code, or is the spline
>calculation in POV-Ray flawed?


The spline code in POV-Ray is working exactly as it should.  It just doesn't
work quite the way you expect it to.  POV-Ray's splines are actually the
combination of three splines: a "x as a function of time" spline, a "y as a
function of time" spline, and a "z as a function of time" spline, where
"time" is the first number in each spline entry.

What's happening in your case is that you are asking the "y as a function of
time" spline to turn a sharper corner than it is able to.  As a result, the
spline does the best it can, and produces those curlicues.  I'd suggest
fixing it by playing around with the exact positioning of the control
points, possibly adding or removing some.  Another solution would be to
split the spline into two splines.

--
Mark


Post a reply to this message

From: Rune
Subject: Re: Twisted sp(l)ine
Date: 27 Sep 2001 11:35:00
Message: <3bb34724@news.povray.org>
"Mark Wagner" wrote:
> The spline code in POV-Ray is working exactly as it should.

Well, except the bug that causes some control points to be ignored, but you
couldn't reproduce that on your development model, so it was never fixed.

Furthermore the cubic spline function is different from the cubic spline
used in prisms, even if the control points are exactly the same. While that
may not be a bug, it sure is a strange inconsistency.

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated June 26)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: David Wallace
Subject: Re: Twisted sp(l)ine
Date: 29 Sep 2001 16:07:17
Message: <3BB629E8.341EF59@earthlink.net>
Well, I went to look at the spreadsheet I used to set the parameter values
(their separation is proportional to the distance between points) and found that
some of the point locations there were inaccurate.  After fixing them, the
spline looks like this:

#declare spHull2 = spline {
 cubic_spline
 -0.20924, < 488, -66>
  0.00000, < 525,   0>
  0.20924, < 488,  66>
  0.46462, < 400,  94>
  1.57080, <   0,  95>
  2.67697, <-400,  94>
  2.93235, <-488,  66>
  3.14159, <-525,   0>
  3.35084, <-488, -66>
  3.60621, <-400, -94>
  4.71239, <   0, -95>
  5.81856, < 400, -94>
  6.07394, < 488, -66>
  6.28319, < 525,   0>
  6.49243, < 488,  66>
}

The resulting shape still bends in on itself somewhat in the middle (x value=0),
but the gross curlicues are gone.


Mark Wagner wrote:

> David Wallace wrote in message <3BB25EFE.719F8B0E@earthlink.net>...
> >I hope this is just a user screw-up, but I think it bears mentioning.
> >The spline calculations could well have some arcane bug.  Consider the
> >test code below:
>
> [code snipped]
>
> >The code (as written) draws the outline of a shape similar to a Pac-Man
> >ghost, which is what I want.  The second spline, spHull2, is supposed to
> >draw something akin to an oval, but it draws weird curlicues near the
> >middle (where the parameter is pi).  I've been racking my brain trying
> >to find the error in my spline which causes this with no success.  So...
> >can you untwist the knot in my spline via the code, or is the spline
> >calculation in POV-Ray flawed?
>
> The spline code in POV-Ray is working exactly as it should.  It just doesn't
> work quite the way you expect it to.  POV-Ray's splines are actually the
> combination of three splines: a "x as a function of time" spline, a "y as a
> function of time" spline, and a "z as a function of time" spline, where
> "time" is the first number in each spline entry.
>
> What's happening in your case is that you are asking the "y as a function of
> time" spline to turn a sharper corner than it is able to.  As a result, the
> spline does the best it can, and produces those curlicues.  I'd suggest
> fixing it by playing around with the exact positioning of the control
> points, possibly adding or removing some.  Another solution would be to
> split the spline into two splines.
>
> --
> Mark


Post a reply to this message

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