|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
As Warp has pointed out, it would be convenient if one was not forced to
specify T values for all the control points in a spline. I've tried making a
macro which fill in the missing T values. It takes an array as input.
But I had forgotten that arrays do not allow abbreviating vectors as floats,
as it is allowed almost everywhere else in POV-Ray. So the syntax is uglier
than what I had hoped. The idea is that specified T values are multiplied
with y, while unspecified T values are marked with an x. See below.
My question is - is the below syntax too ugly or would it be acceptable for
a macro included in the POV-Ray distribution?
#declare SplineArray =
array[7*2] {
0.0*y, <0,1,2>,
x, <1,5,0>,
x, <4,1,0>,
0.9*y, <0,2,1>,
1.0*y, <0,0,1>,
x, <6,5,4>,
2.0*y, <4,3,2>,
}
#declare Spline =
spline {
cubic_spline
SplineAutoT(SplineArray)
}
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated Feb 16)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Rune" <run### [at] mobilixnetdk> wrote in message
news:3c784c61@news.povray.org...
> As Warp has pointed out, it would be convenient if one was not forced to
> specify T values
>
> But I had forgotten that arrays do not allow abbreviating vectors as
floats
Lost me on this whole idea. Looks like it would create splines with
multiple points for the same "time" value (x=1 and all). Making for some
odd pretzel shapes. ;-)
But if it does as you plan it to do it isn't too awkward, just not terribly
clean.
bob h
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3c784c61@news.povray.org>,
"Rune" <run### [at] mobilixnetdk> wrote:
> But I had forgotten that arrays do not allow abbreviating vectors as floats,
> as it is allowed almost everywhere else in POV-Ray. So the syntax is uglier
> than what I had hoped. The idea is that specified T values are multiplied
> with y, while unspecified T values are marked with an x. See below.
>
> My question is - is the below syntax too ugly or would it be acceptable for
> a macro included in the POV-Ray distribution?
A suggestion: use macros for the entries.
#macro SE1(T, Point) y*T, Point #end
#macro SE2(Point) x, Point #end
array[7*2] {
SE1(0, < 0, 1, 2>),
SE2(< 1, 5, 0>),
SE2(< 4, 1, 0>),
SE1(0.9, < 0, 2, 1>),
SE1(1.0, < 0, 0, 1>),
SE2(< 6, 5, 4>),
SE1(2.0, < 4, 3, 2>),
}
Ugh, I don't like it either. The macro name needs to be short, since it
will be repeated so many times, but that increases the chance of name
collision. Maybe it would be better to use file I/O to read in a spline
file.
Using the vectors actually doesn't look that bad...'x' is pretty
standard as a standin for "unknown", but something better could be used
in place of 'y'...I don't think 'v' will work, POV might interpret it as
a 2D vector. Maybe #declare T = y;? It could easily be overwritten by
some scene variable though...
Hmm. How about this: use 4D vectors in the array. When the T value is to
be unspecified, give it some value like -1 that will indicate that it
needs to be interpolated. Or use 4D vectors and the present syntax, so
you can use "NNN*t" in place of "NNN*y".
--
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"bob h" wrote:
> Lost me on this whole idea.
The idea is that the macro fill in the unspecified T values for you using
linear interpolation.
The macro will convert this:
array[7*2] {
0.0*y, <0,1,2>,
x, <1,5,0>,
x, <4,1,0>,
0.9*y, <0,2,1>,
1.0*y, <0,0,1>,
x, <6,5,4>,
2.0*y, <4,3,2>,
}
Into this:
0.0, <0,1,2>,
0.3, <1,5,0>,
0.6, <4,1,0>,
0.9, <0,2,1>,
1.0, <0,0,1>,
1.5, <6,5,4>,
2.0, <4,3,2>,
You're only required to specify the first and last T value; the rest are
optional. In some cases that can make it easier to work with splines.
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated Feb 16)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Christopher James Huff" wrote:
> A suggestion: use macros for the entries.
Good suggestion, though I think I'll only use one macro, and still use the
idea about using an x for unspecified. IMO that's actually *more* clear, at
least indention-wise. However, I can get rid of the *y part. It also has
another advantage: The user can abbreviate vectors as floats, which is
particulary useful when one only wants to interpolate floats in the first
place. That's not possible in the pure macro solution, as all elements in a
vector macro has to be explicitely written as vectors, i.e. 0.1 doesn't
work, only <0.1,0.1,0.1> or 0.1*<1,1,1>.
> Using the vectors actually doesn't look that bad...'x' is
> pretty standard as a standin for "unknown", but something
> better could be used in place of 'y'...I don't think 'v'
> will work, POV might interpret it as a 2D vector.
It won't work.
> Maybe #declare T = y;? It could easily be overwritten by
> some scene variable though...
Yes.
> Hmm. How about this: use 4D vectors in the array.
Then all the vectors have to be explicitely written as 4D vectors, also the
points. Not a good solution.
I'll see if I can make the macro approach work well.
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated Feb 16)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
in news:3c784c61@news.povray.org Rune wrote:
> #declare SplineArray =
> array[7*2] {
> 0.0*y, <0,1,2>,
> x, <1,5,0>,
>
This is ugly. Why don't you take a linear (or other) spline as input for
generating the T-values?
And I think this discussion if off-topic here,
followup set to povray.advanced-users
Ingo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
How's this:
#declare Spline =
spline {
cubic_spline
SplineAutoT(array[7*2]{
(SCP( 0.0, <0,1,2>))
(SCP( x, <1,5,0>))
(SCP( x, <4,1,0>))
(SCP( 0.9, <0,2,1>))
(SCP( 1.0, <0,0,1>))
(SCP( x, <6,5,4>))
(SCP( 2.0, <4,3,2>))
})
}
Note that the extra parentheses are necessary as macros can't be called
directly in arrays without them.
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated Feb 16)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"ingo" wrote:
> This is ugly. Why don't you take a linear (or other)
> spline as input for generating the T-values?
Because then you'd have to separate the list of T values from the list of
points. But have you seen my other posts in this thread? I've made a
different syntax.
> And I think this discussion if off-topic here,
> followup set to povray.advanced-users
It's not off-topic IMO as it's about a macro for possible inclusion in the
standard includes in POV-Ray 3.5.
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated Feb 16)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ok, new thinking - how about this:
#declare Spline =
spline {
cubic_spline
Spline_Points(7)
SCP( 0.0, <0,1,2>)
SCP( x, <1,5,0>)
SCP( x, <4,1,0>)
SCP( 0.9, <0,2,1>)
SCP( 1.0, <0,0,1>)
SCP( x, <6,5,4>)
SCP( 2.0, <4,3,2>)
Spline_End()
}
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated Feb 16)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hey, it just occurred to me that this syntax could be extended with other
options. Imagine the following:
#declare Spline =
spline {
Spline_Type(Cubic_Spline)
Spline_Points(7)
Spline_Speed(Constant)
SCP( 0.0, <0,1,2>)
SCP( x, <1,5,0>)
SCP( x, <4,1,0>)
SCP( x, <0,2,1>)
SCP( x, <0,0,1>)
SCP( x, <6,5,4>)
SCP( 2.0, <4,3,2>)
Spline_End()
}
I think this is beginning to be interesting! I hope you agree that the
approach shown here would fit well in the official include files?
Rune
--
3D images and anims, include files, tutorials and more:
Rune's World: http://rsj.mobilixnet.dk (updated Feb 16)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|