![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
This is about the spline type by Wolfgang Ortmann. (Splines with variables.)
The documentation says that it can handle both vectors and floats, but
whenever I use floats they are converted to vectors, as the code below
shows.
#version unofficial MegaPov 0.6;
#declare MySpline = spline {cubic_spline
0.0, 0.2,
0.5, 0.3,
1.0, 0.1,
}
#debug str(MySpline(0),7,4)
Is there any way around this problem?
Using MySpline(0).x is not an option, because I use the same macro to handle
floats and vectors, and I don't want my vectors to be converted to floats.
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated October 9)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Rune <run### [at] iname com> wrote:
: whenever I use floats they are converted to vectors
[snip]
: I don't want my vectors to be converted to floats.
There's an inconsistency here.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Warp" wrote:
> : whenever I use floats they are converted to vectors
> [snip]
> : I don't want my vectors to be converted to floats.
>
> There's an inconsistency here.
No there's not. First I was talking about the *problem*, which is that
floats are converted to vectors.
Then I asked for a solution.
Oh, but can't I just add .x after the spline call to avoid vectors?
No, because that would convert my vectors to floats, and I don't want that
either.
If you reread my original post I believe that you will find it clear that
that is what I really meant. :)
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated October 9)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Uh, it was a bit too complicated for my simple mind... :)
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Rune wrote:
>
> Using MySpline(0).x is not an option, because I use the same macro to handle
> floats and vectors, and I don't want my vectors to be converted to floats.
>
Well, if I understand the problem correctly, this should avoid converting the
values to float when they shouldn't be (untested!):
#if(MySpline(n).x = MySpline(n).y & MySpline(n).x = MySpline(n).z)
#declare Val = 0 + MySpline(n).x; //float
#else
#declare Val = <0,0,0> + MySpline(n); //vector
#end
--
Margus Ramst
Personal e-mail: mar### [at] peak edu ee
TAG (Team Assistance Group) e-mail: mar### [at] tag povray org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Margus Ramst" wrote:
> Well, if I understand the problem correctly, this should avoid
> converting the values to float when they shouldn't be (untested!):
<snipped>
Yes, that works in many cases, but vectors such as <0,0,0> and <3,3,3> will
still be converted to floats 0 and 3 respectively.
Anyway, I think I can get around it, I just hope it will be fixed for the
next version.
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated October 9)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Rune wrote:
>
> Yes, that works in many cases, but vectors such as <0,0,0> and <3,3,3> will
> still be converted to floats 0 and 3 respectively.
>
Does it matter? They get promoted back to <0,0,0> and <3,3,3> respectively, if a
function requires a vector value.
If you want to use them with e.g. dot operators, you can force vector promotion
with (Float + <0,0,0>)
--
Margus Ramst
Personal e-mail: mar### [at] peak edu ee
TAG (Team Assistance Group) e-mail: mar### [at] tag povray org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Margus Ramst" wrote:
> Rune wrote:
> >
> > Yes, that works in many cases, but vectors such as <0,0,0> and
> > <3,3,3> will still be converted to floats 0 and 3 respectively.
>
> Does it matter? They get promoted back to <0,0,0> and <3,3,3>
> respectively, if a function requires a vector value.
Ah, yes. You're right!
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated October 9)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Andrew Clinton
Subject: Re: Spline bug: floats converted to vectors
Date: 4 Dec 2000 15:18:50
Message: <3A2C25E2.E423AAE9@ibm.net>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
While we are talking about spline bugs, here is another one. One cannot do the
following:
#declare thespline = Spline {
cubic_spline
..
floats, points
..
}
...
do something with the spline
...
#undef thespline // this produces an error
This problem can become an issue when you are using huge numbers of splines in
the scene and the memory for them never gets freed (needless waste of space)
Andrew C
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Andrew Clinton wrote in message <3A2C25E2.E423AAE9@ibm.net>...
>While we are talking about spline bugs, here is another one. One cannot do
the
>following:
>
>#declare thespline = Spline {
> cubic_spline
> ..
> floats, points
> ..
>}
>...
>do something with the spline
>...
>
>#undef thespline // this produces an error
Since I've been working on improving the spline stuff, I'll take a look into
that.
--
Mark
"The derivative of sin(2x) is cos(2x)" - Matt Giwer
"I never said that" - Matt Giwer
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |