POV-Ray : Newsgroups : povray.advanced-users : spline question Server Time
24 Nov 2024 14:41:46 EST (-0500)
  spline question (Message 1 to 9 of 9)  
From: LEO BOLOGNA
Subject: spline question
Date: 6 May 2006 07:05:00
Message: <web.445c828e6f6753c5443403d30@news.povray.org>
My question is: in povray does splines (linear,quadratic or cubic) permit to
define only curves or surface also?

and, if it's possible to use splines to define a surface, does its degree
have to be the same in "u" and "v" directions? or, for example, can I
define a spline surface that has degree 1 in one direction and degree 2 in
the other one?!?!

Thanks
Leo


Post a reply to this message

From: Mike Williams
Subject: Re: spline question
Date: 6 May 2006 07:17:52
Message: <WfWW4EA5WIXEFwRC@econym.demon.co.uk>
Wasn't it LEO_BOLOGNA who wrote:
>My question is: in povray does splines (linear,quadratic or cubic) permit to
>define only curves or surface also?
>
>and, if it's possible to use splines to define a surface, does its degree
>have to be the same in "u" and "v" directions? or, for example, can I
>define a spline surface that has degree 1 in one direction and degree 2 in
>the other one?!?!

Spline functions themselves are always curves, not surfaces.

You can use splines in an isosurface function to draw surfaces that are
controlled by spline functions. You could use splines of different types
to control the x and z coordinates. In the third example on this page I
could just as well have used the x values from one spline and the z
values from a spline of a different type.

http://www.econym.demon.co.uk/isotut/more.htm

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Warp
Subject: Re: spline question
Date: 6 May 2006 07:27:45
Message: <445c8831@news.povray.org>
LEO_BOLOGNA <l_o### [at] yahooit> wrote:
> My question is: in povray does splines (linear,quadratic or cubic) permit to
> define only curves or surface also?

  A spline is by definition a curve.

  You can use splines to create eg. meshes (that isn't even too difficult,
just requires some SDL coding). You can also just use bicubic patches which
use bezier splines.

-- 
                                                          - Warp


Post a reply to this message

From: LEO BOLOGNA
Subject: Re: spline question
Date: 6 May 2006 09:15:00
Message: <web.445ca0915792ee8a443403d30@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> In the third example on this page I
> could just as well have used the x values from one spline and the z
> values from a spline of a different type.
>
> http://www.econym.demon.co.uk/isotut/more.htm

Ok I've read this page and I find it very interesting...but if I try to put
this piece of code in a .pov file the result isn't similar to the image in
this site...

my pov file is:

#include "colors.inc"

camera {

location <10, 10, -10>

look_at <0, 0, 0>
}
light_source { <25, 25, -100> color rgb 1 }

#declare S = function {
   spline {
     natural_spline
      -1, < 0.5, 0, 0.0>,
    -0.5, < 0.2, 0, 0.4>,
    0.01, < 0.2, 0, 0.2>,
     0.5, < 0.4, 0, 0.4>,
       1, < 0.0, 0,-0.6>
   }
 }

isosurface {
  function { y - S(x).x - S(z).z }
 contained_by { box { -10, 10 } }
 pigment{Red}
}


Have you got any idea?!?!

Thanks
Leo


Post a reply to this message

From: Mike Williams
Subject: Re: spline question
Date: 6 May 2006 10:09:41
Message: <2dV+IAA13KXEFwVu@econym.demon.co.uk>
Wasn't it LEO_BOLOGNA who wrote:
>Mike Williams <nos### [at] econymdemoncouk> wrote:
>> In the third example on this page I
>> could just as well have used the x values from one spline and the z
>> values from a spline of a different type.
>>
>> http://www.econym.demon.co.uk/isotut/more.htm
>
>Ok I've read this page and I find it very interesting...but if I try to put
>this piece of code in a .pov file the result isn't similar to the image in
>this site...
>
>my pov file is:
>
>#include "colors.inc"
>
>camera {
>
>location <10, 10, -10>
>
>look_at <0, 0, 0>
>}
>light_source { <25, 25, -100> color rgb 1 }
>
>#declare S = function {
>   spline {
>     natural_spline
>      -1, < 0.5, 0, 0.0>,
>    -0.5, < 0.2, 0, 0.4>,
>    0.01, < 0.2, 0, 0.2>,
>     0.5, < 0.4, 0, 0.4>,
>       1, < 0.0, 0,-0.6>
>   }
> }
>
>isosurface {
>  function { y - S(x).x - S(z).z }
> contained_by { box { -10, 10 } }
> pigment{Red}
>}
>
>
>Have you got any idea?!?!

Your spline is only defined between -1 and +1, so in the regions outside
that, the spline evaluates to zero, so the isosurface is just {y - 0}
and you get a flat plane.

Either change to contained_by {box {-1,1}}
  and zoom in
  and increase your max_gradient to 2


Or use   function { y/10 - S(x/10).x - S(z/10).z }
  and decrease your max_gradient to 0.25


Or arrange for your spline to cover the whole of the region that you're
going to render
#declare S = function {
   spline {
     natural_spline
     -10, < 5, 0, 0>,
      -5, < 2, 0, 4>,
    0.01, < 2, 0, 2>,
       5, < 4, 0, 4>,
      10, < 0, 0,-6>
   }
 }
and increase your max_gradient to 2

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: LEO BOLOGNA
Subject: Re: spline question
Date: 6 May 2006 12:05:00
Message: <web.445cc8d05792ee8a443403d30@news.povray.org>
> Your spline is only defined between -1 and +1, so in the regions outside
> that, the spline evaluates to zero, so the isosurface is just {y - 0}
> and you get a flat plane.
>
> Either change to contained_by {box {-1,1}}
>   and zoom in
>   and increase your max_gradient to 2
>
>
> Or use   function { y/10 - S(x/10).x - S(z/10).z }
>   and decrease your max_gradient to 0.25
>
>
> Or arrange for your spline to cover the whole of the region that you're
> going to render
> #declare S = function {
>    spline {
>      natural_spline
>      -10, < 5, 0, 0>,
>       -5, < 2, 0, 4>,
>     0.01, < 2, 0, 2>,
>        5, < 4, 0, 4>,
>       10, < 0, 0,-6>
>    }
>  }
> and increase your max_gradient to 2
>
> --
> Mike Williams
> Gentleman of Leisure

thanks mike, this message is very helpful for me.
I've got another problem, now:

I know every information of a spline:
- I know the degree (2)

- I know the coordinates of each control point (9 in total)
0 3.000000e-01 0.000000e+00 1.000000e+00
3.000000e-01 3.000000e-01 0.125000e+00 7.071070e-01
3.000000e-01 0 0.250000e+00 1.000000e+00
3.000000e-01 -3.000000e-01 0.37500e+00 7.071070e-01
0 -3.000000e-01 0.50000e+00 1.000000e+00
-3.000000e-01 -3.000000e-01 0.625000e+00 7.071070e-01
-3.000000e-01 0 0.750000e+00 1.000000e+00
-3.000000e-01 3.000000e-01 0.875000e+00 7.071070e-01
0 3.000000e-01 1.000000e+00 1.000000e+00

- I know the knot partition (12 knot in total)
0.000000e+00
0.000000e+00
0.000000e+00
2.500000e-01
2.500000e-01
5.000000e-01
5.000000e-01
7.500000e-01
7.500000e-01
1.000000e+00
1.000000e+00
1.000000e+00

How should I combine (from a mathematical point of view) these information
to obtain the same spline on povray?
So, in which manner I have to fill the sequent statement?

spline {
     natural_spline
      ??, < ??, ??, ??>,
      ??, < ??, ??, ??>,
      ??, < ??, ??, ??>,
      ??, < ??, ??, ??>,
      ??, < ??, ??, ??>,
      ??, < ??, ??, ??>,
      ??, < ??, ??, ??>,
      ??, < ??, ??, ??>,
      ??, < ??, ??, ??>,
      ??, < ??, ??, ??>,
      ??, < ??, ??, ??>,
      ??, < ??, ??, ??>
   }

thanks
leo


Post a reply to this message

From: Mike Williams
Subject: Re: spline question
Date: 6 May 2006 15:54:48
Message: <y4UvRAAzzPXEFwHT@econym.demon.co.uk>
Wasn't it LEO_BOLOGNA who wrote:
>
>I know every information of a spline:
>- I know the degree (2)
>
>- I know the coordinates of each control point (9 in total)
>0 3.000000e-01 0.000000e+00 1.000000e+00
>3.000000e-01 3.000000e-01 0.125000e+00 7.071070e-01
>3.000000e-01 0 0.250000e+00 1.000000e+00
>3.000000e-01 -3.000000e-01 0.37500e+00 7.071070e-01
>0 -3.000000e-01 0.50000e+00 1.000000e+00
>-3.000000e-01 -3.000000e-01 0.625000e+00 7.071070e-01
>-3.000000e-01 0 0.750000e+00 1.000000e+00
>-3.000000e-01 3.000000e-01 0.875000e+00 7.071070e-01
>0 3.000000e-01 1.000000e+00 1.000000e+00
>
>- I know the knot partition (12 knot in total)
>0.000000e+00
>0.000000e+00
>0.000000e+00
>2.500000e-01
>2.500000e-01
>5.000000e-01
>5.000000e-01
>7.500000e-01
>7.500000e-01
>1.000000e+00
>1.000000e+00
>1.000000e+00
>
>How should I combine (from a mathematical point of view) these information
>to obtain the same spline on povray?

I've no idea what any of your terminology means.

What is a degree?
Why do your control points have four dimensions rather than three?
What is a knot partition?

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: spline question
Date: 6 May 2006 16:24:06
Message: <445d05e6$1@news.povray.org>
Mike Williams wrote:
...
> I've no idea what any of your terminology means.
> 
> What is a degree?
> Why do your control points have four dimensions rather than three?
> What is a knot partition?

Mike,
I think his questions may be related to his two recent threads about 
NURBS in POV-Ray:

From: LEO BOLOGNA
Subject: mesh&nurbs question...
Date: 4 May 2006 14:00:01
http://news.povray.org/povray.advanced-users/thread/%3Cweb.445a0800e57eb53272071f7b0%40news.povray.org%3E/

From: LEO BOLOGNA
Subject: how to use nurbs on povray?!
Date: 3 May 2006 16:15:00
http://news.povray.org/povray.advanced-users/thread/%3Cweb.4458d6962d01a59e72071f7b0%40news.povray.org%3E/

-- 
Tor Olav
http://subcube.com


Post a reply to this message

From: LEO BOLOGNA
Subject: Re: spline question
Date: 7 May 2006 06:25:01
Message: <web.445dca145792ee8a443403d30@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:

> I've no idea what any of your terminology means.

degree, control point and knot partition are tipical parameters used to
describe a spline curve...

> What is a degree?

the degree of a spline is the maximum degree of each polinomial
interpolation functions that define the spline...linear spline has degree
1...quadratic spline has degree 2...etc

> Why do your control points have four dimensions rather than three?

ignore the fourth number...

> What is a knot partition?

It's a set of number that specify the subdivision of the spline's parametric
domain...

In povray, referring to spline statement..

spline {
     linear_spline | quadratic_spline | cubic_spline
      -1, < 0, 0.5, 0.0>,
    -0.5, < 0, 0.2, 0.4>,
    0.01, < 0, 0.2, 0.2>,
     0.5, < 0, 0.4, 0.4>,
       1, < 0, 0.0,-0.6>
   }

the degree is specified by the spline's type...
-1,-0.5,0.01,0.5,1 determine the knot partition...
< 0, 0.5, 0.0> , < 0, 0.2, 0.4> , < 0, 0.2, 0.2> , etc... are control points
coordinates...

I hope you can undertand better my problem now...
Leo


Post a reply to this message

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