POV-Ray : Newsgroups : povray.advanced-users : Lathe and sor splines question Server Time
11 Oct 2026 19:14:40 EDT (-0400)
  Lathe and sor splines question (Message 1 to 18 of 18)  
From: Nieminen Juha
Subject: Lathe and sor splines question
Date: 12 Mar 2000 08:00:15
Message: <38cb94de@news.povray.org>
The lathe object can use linear, quadratic, cubic and bezier splines. The
SOR object uses some unnamed spline type.
  I have some questions.

  Suppose that I want to draw (just in a plain 2D graphic window) a qudratic,
cubic or bezier spline given the control points.
  Can someone tell me the algorithm used to calculate the curve for each type
of spline? Preferably I would like to get all the points that will form a
contiguous curve in the drawing bitmap (no gaps and no points drawn in the
same place) given the resolution of the drawing window, but also a less
perfect solution is ok.

  Also I would like an algorithm to draw the spline curve used by the SOR
object, given the control points.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Francois Labreque
Subject: Re: Lathe and sor splines question
Date: 12 Mar 2000 10:09:55
Message: <38CBB247.36287DC@attglobal.net>
These algorithms are rather involved,  you should check your library for
books on the subject.

In the one I have (CAD/CAM theory & practice, MCGraw-Hill 1991), the
mathematical explanation of splines and Bezier curves takes about 20
pages.  A bit too long for this ng.

Nieminen Juha wrote:
> 
>   The lathe object can use linear, quadratic, cubic and bezier splines. The
> SOR object uses some unnamed spline type.
>   I have some questions.
> 
>   Suppose that I want to draw (just in a plain 2D graphic window) a qudratic,
> cubic or bezier spline given the control points.
>   Can someone tell me the algorithm used to calculate the curve for each type
> of spline? Preferably I would like to get all the points that will form a
> contiguous curve in the drawing bitmap (no gaps and no points drawn in the
> same place) given the resolution of the drawing window, but also a less
> perfect solution is ok.
> 
>   Also I would like an algorithm to draw the spline curve used by the SOR
> object, given the control points.
> 
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/

-- 
Francois Labreque | The surest sign of the existence of extra-
     flabreq      | terrestrial intelligence is that they never
        @         | bothered to come down here and visit us!
  attglobal.net                                  - Calvin


Post a reply to this message

From: Alberto
Subject: Re: Lathe and sor splines question
Date: 12 Mar 2000 10:38:05
Message: <38CBB8C6.C64D3ECE@usb.ve>
A very good place to read about bezier curves and bezier patches is

http://graphics.cs.ucdavis.edu/GraphicsNotes/Graphics-Notes.html

I hope this may help you.

Alberto.


Post a reply to this message

From: Peter Popov
Subject: Re: Lathe and sor splines question
Date: 12 Mar 2000 11:27:09
Message: <DsXLOCkUqSYk+L=nc482rwHv2jZg@4ax.com>
On 12 Mar 2000 08:00:15 -0500, Nieminen Juha
<war### [at] sarakerttunencstutfi> wrote:

>  Also I would like an algorithm to draw the spline curve used by the SOR
>object, given the control points.

I suppose the SOR object uses a polynomial spline. I will try to find
the algorithms for the Newton / Lagrange interpolation polynoms for
you.


Peter Popov
pet### [at] usanet
ICQ: 15002700


Post a reply to this message

From: Nieminen Juha
Subject: Re: Lathe and sor splines question
Date: 12 Mar 2000 13:56:43
Message: <38cbe86a@news.povray.org>
Alberto <jac### [at] usbve> wrote:
: A very good place to read about bezier curves and bezier patches is

: http://graphics.cs.ucdavis.edu/GraphicsNotes/Graphics-Notes.html

  Thanks. However it only explains the bezier curves (which are actually the
ones I less need, unfortunately). Thanks anyways.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Nieminen Juha
Subject: Re: Lathe and sor splines question
Date: 13 Mar 2000 06:46:18
Message: <38ccd50a@news.povray.org>
This seems to be one of those things that nobody knows how to do it. I
have tried searching in the www, but nothing.

  Isn't there really ANY info about it?
  Thinking about it, the points don't need to be at equal distances, as long
as there are some points at the curve. I can draw lines between them. If there
are enough points it will be a good enough approximation.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Chris Huff
Subject: Re: Lathe and sor splines question
Date: 13 Mar 2000 06:55:33
Message: <chrishuff_99-C45575.06572513032000@news.povray.org>
In article <38ccd50a@news.povray.org>, Nieminen Juha 
<war### [at] sarakerttunencstutfi> wrote:

>   This seems to be one of those things that nobody knows how to do it. I
> have tried searching in the www, but nothing.
> 
>   Isn't there really ANY info about it?
>   Thinking about it, the points don't need to be at equal distances, as 
> long as there are some points at the curve. I can draw lines between 
> them. If there are enough points it will be a good enough 
> approximation.

If this is in MegaPOV, you could scan the surface with the trace() 
function...

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: ingo
Subject: Re: Lathe and sor splines question
Date: 13 Mar 2000 10:06:42
Message: <8EF6A1B9Eseed7@204.213.191.228>
Nieminen Juha wrote:

>  Can someone tell me the algorithm used to calculate the curve for each
>  type 
>of spline?

Not sure if this is what you are looking for, do a search at Deja for Steve 
Noskow in c.g.r.r. In the result start with the first post from the top. He 
may be the person who can help you.

Ingo

-- 
Photography: http://members.home.nl/ingoogni/
Pov-Ray    : http://members.home.nl/seed7/


Post a reply to this message

From: ingo
Subject: Re: Lathe and sor splines question
Date: 13 Mar 2000 10:09:07
Message: <8EF6A5990seed7@204.213.191.228>
ingo wrote:

>In the result start with the first post from the top

Sorry, I meant third post.

http://www.deja.com/dnquery.xp?ST=QS&DBS=1&groups=comp.graphics.rendering.r
aytracing&QRY=Steve+Noskow&svcclass=dnold

Ingo

-- 
Photography: http://members.home.nl/ingoogni/
Pov-Ray    : http://members.home.nl/seed7/


Post a reply to this message

From: Nieminen Juha
Subject: Re: Lathe and sor splines question
Date: 13 Mar 2000 12:19:57
Message: <38cd233c@news.povray.org>
Chris Huff <chr### [at] yahoocom> wrote:
: If this is in MegaPOV, you could scan the surface with the trace() 
: function...

  No, I just want to make this in my own (2D) program.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Peter Popov
Subject: Re: Lathe and sor splines question (Warning: binary attached) - interpolation_formulas.zip
Date: 14 Mar 2000 10:28:09
Message: <GhfOOFd6RkDyVsndqfmzl6rbzg1I@4ax.com>
On 12 Mar 2000 08:00:15 -0500, Nieminen Juha
<war### [at] sarakerttunencstutfi> wrote:

>  Also I would like an algorithm to draw the spline curve used by the SOR
>object, given the control points.

I think this is what is used in the SOR object, at least it looks so
to me. See if it works as expected. I hope there aren't nasty typos :)


Peter Popov
pet### [at] usanet
ICQ: 15002700


Post a reply to this message


Attachments:
Download 'interpolation_formulas.zip' (11 KB)

From: Nieminen Juha
Subject: Re: Lathe and sor splines question
Date: 14 Mar 2000 12:20:07
Message: <38ce74c7@news.povray.org>
Serge LAROCQUE <sgl### [at] hotmailcom%> wrote:
: I have an algorithm (from my old notes) for a cubic spline. It, however, works
: with through points rather than control points.

  That's exactly how it should (as the lathe object works; see the povray
documentation).

: For 'n' points, the algorithm
: produces 'n-1' cubic polynomials for in between the points

  In that case it may not be the algorithm used by povray. In the lathe
object, using a cubic spline, 'n' points produce a curve that goes through
'n-2' points, ie. starts from point 2 and ends at the point n-1. The first
and last points are only control points.
  This means that first we take the 4 first points and calculate the curve
between point 2 and 3 using points 1 and 4 as control points (the curve starts
from point 2 and ends at point 3). Then we take the points 2 to 5 and
calculate the curve that starts from point 3 and end at point 4 using the
points 2 and 5 as control points, and so on. In result we get a smooth
curve that goes from point 2 to point n-1.
  A quadratic curve generates 'n-1' curve segments since it uses just one
control point instead of two. In this case, too, the curve goes through all
the points.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Nieminen Juha
Subject: Re: Lathe and sor splines question
Date: 15 Mar 2000 05:09:06
Message: <38cf6141@news.povray.org>
Well, if it works for points 2 to n-1 like the lathe in povray, then it's
perfect. Please post a description of how it is done.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Nieminen Juha
Subject: Re: Lathe and sor splines question
Date: 15 Mar 2000 10:58:46
Message: <38cfb336@news.povray.org>
I found a way to easyly approximate very accurately the cubic spline used
in the lathe with a regular bezier spline (I can explain it if someone is
interested).

  But now I need the quadratic spline. Can someone explain the idea behind
it? I know that for each set of 3 points the curve between the 2nd and 3rd
points is calculated using the 1st point as control point (in the cubic
spline also the 4th point was used as control point but not with the
quadratic spline). But how does the 1st point affect the orientation of
the curve in the 2nd and 3rd point? (In the cubic spline the tangent at
point n is parallel to the line that connects points n-1 and n+1)
  I can't see any rule of this kind looking at the curve generated by
povray. Does anyone know it?

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ken
Subject: Re: Lathe and sor splines question
Date: 15 Mar 2000 21:22:12
Message: <38D0459F.433776A5@pacbell.net>
Serge LAROCQUE wrote:

> Why isn't one of the POV team members jumping out with the answer?

Maybe they don't have a ready answer ?

> They wrote the program after all :-)

Dieter Bayer (dba### [at] tomtecde)	wrote the sor, lathe, prism, and
media features for POV-Ray but does not frequent these groups like
some of the other team members do plus he is no longer an active
member of the POV-Team.

-- 
Ken Tyler -  1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Ron Parker
Subject: Re: Lathe and sor splines question
Date: 16 Mar 2000 08:12:02
Message: <38d0dda2$1@news.povray.org>
On Wed, 15 Mar 2000 21:04:27 -0500, Serge LAROCQUE wrote:
>>   But now I need the quadratic spline. Does anyone know it?
>
>Why isn't one of the POV team members jumping out with the answer? They wrote
>the program after all :-)

Maybe we have better things to do?  I hear there's a new version in the works.

Get a copy of the source and read lathe.c, specifically the comments at the
top of the file and the Compute_Lathe function.

-- 
These are my opinions.  I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

From: Nieminen Juha
Subject: Re: Lathe and sor splines question
Date: 16 Mar 2000 09:04:52
Message: <38d0ea03@news.povray.org>
Ron Parker <ron### [at] povrayorg> wrote:
: Get a copy of the source and read lathe.c, specifically the comments at the
: top of the file and the Compute_Lathe function.

  Yes, it explains how to calculate the intersection of a ray with the lathe
but it doesn't explain how to draw a quadratic spline curve.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ron Parker
Subject: Re: Lathe and sor splines question
Date: 16 Mar 2000 09:17:15
Message: <38d0eceb$1@news.povray.org>
On 16 Mar 2000 09:04:52 -0500, Nieminen Juha wrote:
>Ron Parker <ron### [at] povrayorg> wrote:
>: Get a copy of the source and read lathe.c, specifically the comments at the
>: top of the file and the Compute_Lathe function.
>
>  Yes, it explains how to calculate the intersection of a ray with the lathe
>but it doesn't explain how to draw a quadratic spline curve.

You mean that's not what this part does?

*    One spline segment in the (r,w)-plane is given by the equations
*
*      fw(t) = Aw * t^3 + Bw * t^2 + Cw * t + Dw  and
*      fr(t) = Ar * t^3 + Br * t^2 + Cr * t + Dr,
*
*    with the parameter t ranging from 0 to 1 and r = sqrt(u*u+v*v).

A, B, C, and D are calculated by the code in Compute_Lathe.  

-- 
These are my opinions.  I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

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