POV-Ray : Newsgroups : povray.general : Spline parameters Server Time
27 Nov 2024 05:49:50 EST (-0500)
  Spline parameters (Message 1 to 6 of 6)  
From: twister
Subject: Spline parameters
Date: 24 Feb 2009 08:00:00
Message: <web.49a3ee97d251b6ec9ee64130@news.povray.org>
Hi all,

Maybe it is kind of silly question, but as far as I am new to PovRay I can't
deal with it. The thing is I don't understand how the list of values (followed
by points) in the spline declaration works. For linear_spline these values
doesn't matter what is quite obvious. But for quadratic_ or natural_spline they
matters. It is written in documentation they are some parameters, but nothing
more. Where will I find some helpful informationa about spline declarations?
Because otherwise I don't know what I do. Thanks in advance.
Best regards,
Twister


Post a reply to this message

From: Chris B
Subject: Re: Spline parameters
Date: 24 Feb 2009 09:05:09
Message: <49a3fe95$1@news.povray.org>
"twister" <twi### [at] o2pl> wrote in message 
news:web.49a3ee97d251b6ec9ee64130@news.povray.org...
> Hi all,
>
> Maybe it is kind of silly question, but as far as I am new to PovRay I 
> can't
> deal with it. The thing is I don't understand how the list of values 
> (followed
> by points) in the spline declaration works. For linear_spline these values
> doesn't matter what is quite obvious. But for quadratic_ or natural_spline 
> they
> matters. It is written in documentation they are some parameters, but 
> nothing
> more. Where will I find some helpful informationa about spline 
> declarations?
> Because otherwise I don't know what I do. Thanks in advance.
> Best regards,
> Twister

I take it that, in the spline definition:

    spline {
      [SPLINE_IDENTIFIER] |
      [SPLINE_TYPE] |
      [Val_1, <Point_1>[,]
       Val_2, <Point_2>[,]
       ...

you're asking about Val_1, Val_2 etc.

These are fairly arbitrary values that you can think of in a number of 
different ways. It's like a 4th dimension that you can use to index how far 
through the spline you are, but you can really choose what you consider this 
index to represent.

The help suggests thinking of it as time, which is handy when you do 
animations. I usually set it so that the first physical point on the spline 
starts at 0 and the last point ends at 1. This means that in animations it's 
easy to use it with the clock variable to step along the spline in equally 
sized time slices.

When defining a curve in a scene (rather than when using it for animation) 
you can just consider it as an amount that represents how far through the 
spline definition you are. So if you still start the spline at 0 and end at 
1, then 0.5 can represent half way through the spline definition, though 
it's important to realise that this is not a distance, so it may be nowhere 
near the physical mid-point of the spline.

Any help?

Regards,
Chris B.


Post a reply to this message

From: twister
Subject: Re: Spline parameters
Date: 24 Feb 2009 09:30:00
Message: <web.49a40439cf14bf60c9ee64130@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> These are fairly arbitrary values that you can think of in a number of
> different ways. It's like a 4th dimension that you can use to index how far
> through the spline you are, but you can really choose what you consider this
> index to represent.

To be honest I cannot say these values are arbitrary ones because they have
strong impact on the spline shape. Besides, following spline is wrong and
povray returns an error: "Parse Error: Degenerate cylinder, base point = apex
point." It means I cannot define these values in whatever manner I like.

#declare mySpline = spline {
 quadratic_spline
 1, <0,0,0>,
 2, <1,1,0>,
 3, <2,1,0>,


}

> The help suggests thinking of it as time, which is handy when you do
> animations. I usually set it so that the first physical point on the spline
> starts at 0 and the last point ends at 1. This means that in animations it's
> easy to use it with the clock variable to step along the spline in equally
> sized time slices.

I can think of these values as a "timestamps", but they shouldn't change the
spline shape!

> When defining a curve in a scene (rather than when using it for animation)
> you can just consider it as an amount that represents how far through the
> spline definition you are. So if you still start the spline at 0 and end at
> 1, then 0.5 can represent half way through the spline definition, though
> it's important to realise that this is not a distance, so it may be nowhere
> near the physical mid-point of the spline.

?

> Any help?

Still confused...

> Regards,
> Chris B.


Post a reply to this message

From: Chris B
Subject: Re: Spline parameters
Date: 24 Feb 2009 10:31:55
Message: <49a412eb$1@news.povray.org>
"twister" <twi### [at] o2pl> wrote in message 
news:web.49a40439cf14bf60c9ee64130@news.povray.org...
> "Chris B" <nom### [at] nomailcom> wrote:
>> These are fairly arbitrary values that you can think of in a number of
>> different ways. It's like a 4th dimension that you can use to index how 
>> far
>> through the spline you are, but you can really choose what you consider 
>> this
>> index to represent.
>
> To be honest I cannot say these values are arbitrary ones because they 
> have
> strong impact on the spline shape. Besides, following spline is wrong and
> povray returns an error: "Parse Error: Degenerate cylinder, base point = 
> apex
> point." It means I cannot define these values in whatever manner I like.
>
> #declare mySpline = spline {
> quadratic_spline
> 1, <0,0,0>,
> 2, <1,1,0>,
> 3, <2,1,0>,
>
>
> }

By 'arbitrary' I meant they don't represent anything specific and can have 
more or less any values that you like.
The above spline didn't return an error when I just pasted it into a scene 
file and ran it through the parser and the error you mention relates to a 
cylinder rather than a spline, so I suspect it was generated by another part 
of your scene file.


>
>> The help suggests thinking of it as time, which is handy when you do
>> animations. I usually set it so that the first physical point on the 
>> spline
>> starts at 0 and the last point ends at 1. This means that in animations 
>> it's
>> easy to use it with the clock variable to step along the spline in 
>> equally
>> sized time slices.
>
> I can think of these values as a "timestamps", but they shouldn't change 
> the
> spline shape!

I don't think they do change the shape of the spline.

>> Any help?
>
> Still confused...

Well it may be one of those things that just suddenly clicks when someone 
describes it in a certain way, so I'll leave it to others to have a go.

Regards,
Chris B.


Post a reply to this message

From: Peter Hertel
Subject: Re: Spline parameters
Date: 24 Feb 2009 12:25:00
Message: <web.49a42cf2cf14bf602611931b0@news.povray.org>
"twister" <twi### [at] o2pl> wrote:
> Where will I find some helpful informationa about spline declarations?
> Because otherwise I don't know what I do. Thanks in advance.

Hi!
Have you read the documentation? - 2.3.1.1.1  Understanding The Concept of
Splines That's what made it click for me, as Chris B says.
I believe your problem might be related to the invisible control/shape points in
non-linear splines. Anyway, here's some example code on how I like to use
splines. I hope it's helpful.

-Peter


camera{location <3,1,-4> look_at <2,1,0>}
light_source{<1,2,-3>,1}

#local SP = 3; // SplinePoints
// Number of visible/real points in spline (not counting 0)
// Increase this as you increase the points in the spline
// declaration below, and it will automatically place the
// points in an evenly space between 0 and 1.

#local Resolution = 0.01;
// Increase/decrease to pick out less/more points from the
// spline. Try 0.1 or even 0.3-clock*0.25 and command line:
// +k +kff99

#declare Snake = spline{
cubic_spline
-1/SP,<-1,0,-1>, // Shape/control point

0/SP,<0,0,0>,
1/SP,<1,1,0>,
2/SP,<2,1,1>,
3/SP,<3,0,0>,

(SP+1)/SP,<4,-1,-1> // Shape/control point
}

// And now, a small while loop to demonstrate.
#local Variable = 0;
#while (Variable < 1)

        #local Point = Snake(Variable);

        sphere{Point,0.1 pigment {rgb y}}

        #ifdef(Point2)
                cylinder{Point,Point2,0.1 pigment {rgb y}}
        #end

        #local Point2 = Point;


#local Variable = Variable+Resolution;
#end


Post a reply to this message

From: clipka
Subject: Re: Spline parameters
Date: 24 Feb 2009 15:45:00
Message: <web.49a45b27cf14bf60ddaa9d30@news.povray.org>
"twister" <twi### [at] o2pl> wrote:
> Maybe it is kind of silly question, but as far as I am new to PovRay I can't
> deal with it. The thing is I don't understand how the list of values (followed
> by points) in the spline declaration works. For linear_spline these values
> doesn't matter what is quite obvious. But for quadratic_ or natural_spline they
> matters. It is written in documentation they are some parameters, but nothing
> more. Where will I find some helpful informationa about spline declarations?

Did you already check out section 2.3.1.1.1 ("Understanding The Concept of
Splines") of the online help?


Post a reply to this message

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