POV-Ray : Newsgroups : povray.beta-test : splines and negative values Server Time
28 Dec 2024 17:49:27 EST (-0500)
  splines and negative values (Message 1 to 2 of 2)  
From: TreeLimb Jim
Subject: splines and negative values
Date: 12 May 2013 20:10:00
Message: <web.51902dc3fb4c7b72a585941a0@news.povray.org>
I'm running an iMac4,7 and a Mini, both OSX 10.7.5. POVRay 3.7.0RC7. No
regression tests were performed on earlier versions or RCs.

Two items of interest. Labed A) and B)

A) The spline series is not required to be only ascending, as the following
works:
Results in Hard crash.

#declare Good_Spline =
 spline { natural_spline
  1.25, <-0, 20, -16>,// <--- the significance is here
  1.00, <-0, 24, -12>, // start
  0.88, <-12, 32, 5>,
  0.75, <-3, 30, 7>,
  0.63, < 5, 32, 7>,
  0.50, <8, 33, 3>,
  0.25, <10, 34, -1>,
  0.13, <-5, 32, -3>,
  0.00, <0, 33, -0>, // end
  -0.25, <-0, 28, -16>
 };

But discontinuity in the first column this structure causes a crash:
#declare Bad_Spline =
 spline { natural_spline
  -1.25, <-0, 20, -16>,// <--- the significance is here
  1.00, <-0, 24, -12>, // start
  ...
  0.00, <0, 33, -0>, // end
  -0.25, <-0, 28, -16>
 };


B) Parser displays this possible error around the vnormalize() function in
Spline_Trans()
   Possible Parse Error: Normalizing zero-length vector.
See code snips and #debug trace--- I can't see where the code would be
normalizing a zero-length vector.
I got reasonable and acceptable results.

1) Thrown when the first column of the first entry is <= -0.10
2) Thrown when the last column of the last entry is < 1.10

#declare Bad_Spline =
spline { natural_spline
 -0.05, <9.00, 5.6-2, -11.755>, <-- 1) in example below
 0.00, <9.00, 5.6, -11.755>, // start at amp
 0.25, < 6.0, 6.41, -10.8>,
 0.50, < -2.5, 5.4, -11.5>,
 0.75, <-10.0, 6.3, -12.0>,
 0.94, <-16.0, 5.7, -12.5>,
 1.00, <-17.00, 5.4, -12.175>, // end at tank
 1.05, <-17.00, 5.4-2, -12.175> <-- 2)
};

#declare NrSamples = 100;
#for( Nr, 0, 1, 1/NrSamples )
 #debug concat ( "Loc=", VStr(<0,0,0>+Spline(Nr) )," LocNext=",
VStr(<0,0,0>+Spline(Nr+0.1)), "\n" )
 Spline_Trans( Bad_Spline, Nr, y, 0.1, 0.5 )
#end

Results:
Loc=<9.000000,5.600000,-11.755000> LocNext=<8.526543,7.326084,-11.408949>
Possible Parse Error: Normalizing zero-length vector.
Loc=<8.986093,5.917270,-11.741055> LocNext=<8.433156,7.352713,-11.358516>
Loc=<8.965508,6.197908,-11.721148> LocNext=<8.330271,7.359527,-11.307260>
Loc=<8.937962,6.443597,-11.695794> LocNext=<8.217604,7.348206,-11.255697>

#declare Good_Spline =
spline { natural_spline
 -0.1001, <9.00, 5.6-2, -11.755>, <--  in example below
 0.00, <9.00, 5.6, -11.755>, // start at amp
 0.25, < 6.0, 6.41, -10.8>,
 0.50, < -2.5, 5.4, -11.5>,
 0.75, <-10.0, 6.3, -12.0>,
 0.94, <-16.0, 5.7, -12.5>,
 1.00, <-17.00, 5.4, -12.175>, // end at tank
 1.05, <-17.00, 5.4-2, -12.175>
};

Results:
Loc=<9.000000,5.600000,-11.755000> LocNext=<8.495552,6.559671,-11.377576>
Loc=<8.979286,5.748926,-11.734164> LocNext=<8.402657,6.598457,-11.327640>
Loc=<8.952854,5.884985,-11.708339> LocNext=<8.300710,6.628493,-11.277335>
Loc=<8.920372,6.008590,-11.677987> LocNext=<8.189379,6.650191,-11.227123>


Post a reply to this message

From: clipka
Subject: Re: splines and negative values
Date: 13 May 2013 07:22:27
Message: <5190ccf3$1@news.povray.org>
Am 13.05.2013 02:06, schrieb TreeLimb Jim:

> B) Parser displays this possible error around the vnormalize() function in
> Spline_Trans()
>     Possible Parse Error: Normalizing zero-length vector.
> See code snips and #debug trace--- I can't see where the code would be
> normalizing a zero-length vector.
> I got reasonable and acceptable results.

> #declare NrSamples = 100;
> #for( Nr, 0, 1, 1/NrSamples )
>   #debug concat ( "Loc=", VStr(<0,0,0>+Spline(Nr) )," LocNext=",
> VStr(<0,0,0>+Spline(Nr+0.1)), "\n" )
>   Spline_Trans( Bad_Spline, Nr, y, 0.1, 0.5 )
> #end

Spline_Trans also uses the vector Spline(Nr)-Spline(Nr-0.1) (via the 
VProject_Plane macro); you might want to check those as well.


Post a reply to this message

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