|
|
Here's a diff from the official 3.1g to implement toroidal pattern.
It returns the distance of the intersection point from a unit circle
lying on the x,z plane. Good for smoke rings.
I've noticed that the superpatch already has a toroidal token, so if you
apply it to that, just remove the lines that define that token.
Cheers, PoD.
Post a reply to this message
Attachments:
Download 'us-ascii' (2 KB)
|
|
|
|
Hi,
I have included yesterday your toroidal-pattern in my personal compile of the
superpatch. It works fine...
BTW :
It's my first patched Version of Povray/Superpatch which I compile self!
Just for fun I wrote a superellipsoid-pattern, to become more sense programming and
including patches in POV.
Source code follows later.
Zan
PoD schrieb:
> Here's the diff to add toroidal pattern to superpatch.
>
> Cheers, PoD.
>
> ------------------------------------------------------------------------
> diff sp/parstxtr.c sp-toroid/parstxtr.c
> 1076a1077,1081
> > CASE (TOROIDAL_TOKEN)
> > New->Type = TOROIDAL_PATTERN;
> > EXIT
> > END_CASE
> >
> diff sp/pattern.c sp-toroid/pattern.c
> 81a82
> > static DBL toroidal (VECTOR EPoint); /* PoD */
> 1417a1419,1437
> > /* PoD */
> > static DBL toroidal (VECTOR EPoint)
> > {
> > register DBL value;
> > register DBL d2;
> >
> > /*distance from circle = sqrt( y*y + (sqrt(x*x+z*z)-1)*(sqrt(x*x+z*z)-1) )*/
> > /* thanks to John VanSickle and Peter Popov for the formula */
> >
> > d2 = sqrt(EPoint[X]*EPoint[X]+EPoint[Z]*EPoint[Z]) - 1.0;
> > if( fabs(EPoint[Y]) >= 1 || d2 >= 1.0 )
> > return(DBL)0;
> > value = sqrt( EPoint[Y]*EPoint[Y] + d2*d2 );
> > CLIP_DENSITY(value);
> >
> > return(value);
> > }
> > /* PoD */
> >
> 1572a1593
> > case TOROIDAL_PATTERN: value = toroidal (TPoint); break; /* PoD */
> diff sp/pattern.h sp-toroid/pattern.h
> 89a90
> > TOROIDAL_PATTERN, /* PoD */
> Common subdirectories: sp/unix and sp-toroid/unix
> Common subdirectories: sp/windows and sp-toroid/windows
Post a reply to this message
|
|