POV-Ray : Newsgroups : povray.unofficial.patches : Re: POV's splines Server Time
28 Jun 2024 23:33:25 EDT (-0400)
  Re: POV's splines (Message 7 to 16 of 16)  
<<< Previous 6 Messages Goto Initial 10 Messages
From: Rune
Subject: Re: POV's splines
Date: 15 May 2004 08:39:12
Message: <40a60f70$1@news.povray.org>
ABX wrote:
> As mentioned, you still can create lathe-like
> mesh from spline.

Is there some macro for this purpose? The sides of the prism are trivial
of course, but the caps not quite as trivial...

Rune
--
3D images and anims, include files, tutorials and more:
rune|vision:  http://runevision.com **updated Apr 27**
POV-Ray Ring: http://webring.povray.co.uk


Post a reply to this message

From: ABX
Subject: Re: POV's splines
Date: 17 May 2004 02:32:40
Message: <o1nga0l5fou101h0s97s8tl24sqdn6s5li@4ax.com>
On Sat, 15 May 2004 14:39:21 +0200, "Rune" <run### [at] runevisioncom> wrote:
> ABX wrote:
> > As mentioned, you still can create lathe-like
> > mesh from spline.
>
> Is there some macro for this purpose?

http://members.home.nl/seedseven/#lathe

> The sides of the prism are trivial
> of course, but the caps not quite as trivial...

It is even less trivial for all splines when written in C++

ABX


Post a reply to this message

From: Rune
Subject: Re: POV's splines
Date: 17 May 2004 04:49:15
Message: <40a87c8b$1@news.povray.org>
ABX wrote:
> Rune wrote:
>> ABX wrote:
>>> As mentioned, you still can create lathe-like
>>> mesh from spline.
>>
>> Is there some macro for this purpose?
>
> http://members.home.nl/seedseven/#lathe
>
>> The sides of the prism are trivial
>> of course, but the caps not quite as trivial...
>
> It is even less trivial for all splines when
> written in C++

I think I must have been tired. In this whole thread only lathes and
sors have been mentioned, but in my head I was thinking prisms (which
are also based on splines). It is prisms that I think are non-trivial to
generate with a macro due to the end caps...

Rune
--
3D images and anims, include files, tutorials and more:
rune|vision:  http://runevision.com **updated Apr 27**
POV-Ray Ring: http://webring.povray.co.uk


Post a reply to this message

From: David Wallace
Subject: Re: POV's splines
Date: 26 May 2004 05:22:42
Message: <40b461e2@news.povray.org>
Sorry, generating meshes from splines is not trivial, especially when you
have a parametric surface with u = "clock value" and v going around the
spline.  The issue comes from finding a consistent "normal" vector to the
spline to start the mesh circle.  I tried using the standard normal to the
spline (2nd derivative) for this and the results were at best inconsistent,
often leading to a serious case of the "twisties" where the actual radius is
much less than planned.

What I ended up doing was taking an arbitrary normal vector to start with,
then projecting the unit normal point onto the normal plane at the next
point:

<code>
#macro pnt(i, j, p, q, spl)
 #if (j=vMin) // Calculate only at start of circle
  #declare _st = spl(i); // New start point
  #declare _dr = vnormalize(spl(i+1e-4)-spl(i-1e-4)); // New direction
vector
  #if (i=uMin) // Initialization, arbitrary start normal
   #local nrm = vcross(_dr,z);
   #if (vlength(nrm)<.1) #local nrm = vcross(_dr,x); #end // Insurance
against degenerate cross product
   #declare _norm = vnormalize(nrm);
  #else
   #local bas = _ost+_onrm; // get normal offset at old point
   #local prj = (bas+_dr*(vdot(_dr,_st)-vdot(_dr,bas))); // project onto
plane at new point, normal as new direction
   #declare _norm = vnormalize(prj-_st); // new normal traces from new point
to projected point
  #end
  #declare _onrm = _norm; // save old normal vector
  #declare _ost = _st; // save old point
  #declare _ortho = vcross(_dr,_norm); // orthonormal vector
 #end

 #local mrad = rad1*i+rad0*(uMax-i);
 #local irad = 0.85 + 0.10*sin(j*5) + q*.05;
 #local mdir = _norm*cos(j)+_ortho*sin(j);
 _st+mdir*mrad*irad
#end
</code>

For the end caps (i = uMin || i = uMax) just set the radius to 0.  If you
want flat rather than conical ends then set the endpoints just outside the
spline's range and push the endpoints back.

"Rune" <run### [at] runevisioncom> wrote in message
news:40a87c8b$1@news.povray.org...
> ABX wrote:
> > Rune wrote:
> >> ABX wrote:
> >>> As mentioned, you still can create lathe-like
> >>> mesh from spline.
> >>
> >> Is there some macro for this purpose?
> >
> > http://members.home.nl/seedseven/#lathe
> >
> >> The sides of the prism are trivial
> >> of course, but the caps not quite as trivial...
> >
> > It is even less trivial for all splines when
> > written in C++
>
> I think I must have been tired. In this whole thread only lathes and
> sors have been mentioned, but in my head I was thinking prisms (which
> are also based on splines). It is prisms that I think are non-trivial to
> generate with a macro due to the end caps...
>
> Rune
> --
> 3D images and anims, include files, tutorials and more:
> rune|vision:  http://runevision.com **updated Apr 27**
> POV-Ray Ring: http://webring.povray.co.uk
>
>


Post a reply to this message

From: ABX
Subject: Re: POV's splines
Date: 26 May 2004 06:13:51
Message: <nrq8b056ai774uuc6vrk12krbrcqkjt1v9@4ax.com>
On Wed, 26 May 2004 05:24:11 -0400, "David Wallace" <dar### [at] earthlinknet>
wrote:
> Sorry, generating meshes from splines is not trivial, especially when you
> have a parametric surface with u = "clock value" and v going around the
> spline.

I'm not sure I understand you. If u=clock then it is constant per scene (if it
is clock of animation). If you mean u=clock as being parameter of the spline
then most probably you mean different spline as for v parameter.

> The issue comes from finding a consistent "normal" vector to the
> spline to start the mesh circle.

If the spline is closed then finding normal at the end is equally difficult on
start/end as in the middle. Just input for calculating it changes, but
algorithm is the same. I coded it a few times and I'm pretty sure it was done
similar way in http://members.home.nl/seedseven/#param and
http://members.home.nl/seedseven/#lathe as well. Of course those are not
perfect solution but non approximation if perfect.

ABX


Post a reply to this message

From: Rune
Subject: Re: POV's splines
Date: 26 May 2004 06:27:53
Message: <40b47129$1@news.povray.org>
Again, are there any macros available to create mesh *prisms*? So far I
have only heard talk about lathes and sors... Prisms are more difficult
in my opinion.

Rune
--
3D images and anims, include files, tutorials and more:
rune|vision:  http://runevision.com **updated Apr 27**
POV-Ray Ring: http://webring.povray.co.uk


Post a reply to this message

From: ABX
Subject: Re: POV's splines
Date: 26 May 2004 06:46:11
Message: <1ct8b0t8rstib5a4k1th2drimk28tvaoho@4ax.com>
On Wed, 26 May 2004 12:28:14 +0200, "Rune" <run### [at] runevisioncom> wrote:
> Again, are there any macros available to create mesh *prisms*? So far I
> have only heard talk about lathes and sors... Prisms are more difficult
> in my opinion.

Obviously.

ABX


Post a reply to this message

From: David Wallace
Subject: Re: POV's splines
Date: 1 Jun 2004 03:03:33
Message: <40bc2a45@news.povray.org>
My interpretation of an n-sided prism mesh is a 4 by n structure:

Row 1: Radius 0, initial center
Row 2: Radius r, initial center
Row 3: Radius r, final center
Row 4: Radius 0, final center

What is your interpretation?

"Rune" <run### [at] runevisioncom> wrote in message
news:40b47129$1@news.povray.org...
> Again, are there any macros available to create mesh *prisms*? So far I
> have only heard talk about lathes and sors... Prisms are more difficult
> in my opinion.
>
> Rune
> --
> 3D images and anims, include files, tutorials and more:
> rune|vision:  http://runevision.com **updated Apr 27**
> POV-Ray Ring: http://webring.povray.co.uk
>
>


Post a reply to this message

From: ingo
Subject: Re: POV's splines
Date: 1 Jun 2004 03:42:20
Message: <Xns94FB62BDC766Fseed7@news.povray.org>
in news:40bc2a45@news.povray.org David Wallace wrote:

> Row 1: Radius 0, initial center
> Row 2: Radius r, initial center
> Row 3: Radius r, final center
> Row 4: Radius 0, final center
> 
> 

|------\
|_____  \
      |  \
      |   |
   +  |   |
      |   |
______|   /
|        /
|_______/

This is the kind of situation Rune is referring to, I think.


Ingo


Post a reply to this message

From: ABX
Subject: Re: POV's splines
Date: 1 Jun 2004 04:36:17
Message: <kofob0dd8sso6k70buc9egarndskqd2mhp@4ax.com>
On 1 Jun 2004 03:42:20 -0400, ingo <ing### [at] tagpovrayorg> wrote:
> |------\
> |_____  \
>       |  \
>       |   |
>    +  |   |
>       |   |
> ______|   /
> |        /
> |_______/
>
> This is the kind of situation Rune is referring to, I think.

I think the most difficoult problem is hole within prism (subshape):
   ________
  /        \
 /    /\    \
|    /  \    |
|    \  /    |
|     \/     |
 \    /\    /
  \__/  \__/

as in http://www.povray.org/documentation/view/50/#s03_04_03_03

ABX


Post a reply to this message

<<< Previous 6 Messages Goto Initial 10 Messages

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