POV-Ray : Newsgroups : povray.programming : idea:toroidal pattern Server Time
28 Jul 2024 18:21:38 EDT (-0400)
  idea:toroidal pattern (Message 1 to 6 of 6)  
From: PoD
Subject: idea:toroidal pattern
Date: 6 Jul 1999 18:37:23
Message: <37828538.23928F6F@merlin.net.au>
I was just thinking that it should not be too difficult to implement a
toroidal pattern type in POV.

This pattern would return the distance of a point from a unit circle in
the x,z plane (minor radius can be done with a colour/density etc map).

I think that it could be done by
1. rotate point so that it's on the x,y plane
2. let p = <abs(p.x)-1,p.y>
3. find distance of p from origin
but someone with better 3D math skills could probably come up with a
better way.

Anyone think this is a good/bad/stupid/useful idea?

Cheers, PoD.


Post a reply to this message

From: Ron Parker
Subject: Re: idea:toroidal pattern
Date: 6 Jul 1999 20:27:21
Message: <37829e61.517821@news.povray.org>
On Wed, 07 Jul 1999 08:07:44 +0930, PoD <pod### [at] merlinnetau> wrote:

>I was just thinking that it should not be too difficult to implement a
>toroidal pattern type in POV.
...
>Anyone think this is a good/bad/stupid/useful idea?

I think it'd be useful.  If you used it with a modified version of my
torpatch include file, you could make convincing neon with it.


Post a reply to this message

From: Bob Hughes
Subject: Re: idea:toroidal pattern
Date: 6 Jul 1999 20:44:41
Message: <3782A2E4.12AB9499@aol.com>
Seeing as there is a map_type 5 for torus shapes guess it'd be only a
matter of adding in the usual raytracing programming code to the
'texture' part of POV-Ray....

Laughing hysterically to myself because I know nothing whatsoever about
it, but yes, got my (worthless) vote.

Bob


Ron Parker wrote:
> 
> On Wed, 07 Jul 1999 08:07:44 +0930, PoD <pod### [at] merlinnetau> wrote:
> 
> >I was just thinking that it should not be too difficult to implement a
> >toroidal pattern type in POV.
> ...
> >Anyone think this is a good/bad/stupid/useful idea?
> 
> I think it'd be useful.  If you used it with a modified version of my
> torpatch include file, you could make convincing neon with it.

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/homepage.htm
 mailto://inversez@aol.com?Subject=PoV-News


Post a reply to this message

From: Peter Popov
Subject: Re: idea:toroidal pattern
Date: 7 Jul 1999 11:03:19
Message: <37836bab.9960718@204.213.191.228>
Here's what John VanSickle sent to me when I requested that same
feature (more precisely the equation to use in the SuperPatch).

"If your circle is centered around the origin and lies in the x-z
plane, then
the distance from any point (x,y,z) to the nearest point on the circle
will
be:

  sqrt( y*y + (sqrt(x*x+z*z)-1)*(sqrt(x*x+z*z)-1) )

Regards,
John"

I needed it for a ring of cigarette smoke, but it does make cool neon,
too.

Have fun.

Peter Popov
ICQ: 15002700


Post a reply to this message

From: Robert Dawson
Subject: Re: idea:toroidal pattern
Date: 7 Jul 1999 11:35:06
Message: <378373aa@news.povray.org>
PoD <pod### [at] merlinnetau> wrote in message
news:37828538.23928F6F@merlin.net.au...
> I was just thinking that it should not be too difficult to implement a
> toroidal pattern type in POV.
>
> This pattern would return the distance of a point from a unit circle in
> the x,z plane (minor radius can be done with a colour/density etc map).
>
> I think that it could be done by
> 1. rotate point so that it's on the x,y plane
> 2. let p = <abs(p.x)-1,p.y>
> 3. find distance of p from origin
> but someone with better 3D math skills could probably come up with a
> better way.
>
> Anyone think this is a good/bad/stupid/useful idea?

    It's not a bad idea for media; the algorithm I'd use would be

raddist = sqrt(x*x + y*y) - 1.0;
index = sqrt(z*z + raddist*raddist) fmod 1.0;

    For textures, I can't think of many objects it'd look very good on. From
any large distance it looks like onion, it has a kink on the z axis, and in
particular you would not want to use it on a torus! On a cube it would look
a bit like wood with a repeat warp. Not very toroid.

    My own candidate for a "toroidal" texture is a "toroidal twist" texture.
It would be like "spiral" except that it would spiral around the unit
circle. This could look like the stripes on the handle of a candy-cane. I
once coded this as a POV 2 patch - I don't think I still have it, though. I
haven't yet got POV3 to compile and don't now have the time.

    It goes as follows, modulo some singularity trapping (the pattern is
undefined *on* the z axis and unit circle; this is not a bug, it is the way
the universe is. Set the index to 0 on these loci!) and possible silly
mistakes. "Slope" is a parameter that  can be positive, 0, or negative.
Positive or negative determines the sense of the twist; zero creates stripes
running around the torus parallel to the circle at its center. [Stripes in
the purely longitudinal direction, which this can't do, are achieved using
radial.] If it's rational, and frequency is set appropriately, there is no
discontinuity in the pattern; otherwise it doesn't wrap exactly.

    longitude = atan2(x,y);
    latitude = atan2(sqrt(x*x + y*y)-1.0, z);
    index = ((latitude + longitude*slope)/2*PI) fmod 1.0;

On a torus, this can create "knotted" stripes.  As media, combined with a
toroidal texture,
it could create knotted streams of fire, etc.


        -Robert Dawson


Post a reply to this message

From: PoD
Subject: Re: idea:toroidal pattern
Date: 7 Jul 1999 17:48:09
Message: <3783CB32.DBBF88BC@merlin.net.au>
Peter Popov wrote:
> 
> Here's what John VanSickle sent to me when I requested that same
> feature (more precisely the equation to use in the SuperPatch).
> 
> "If your circle is centered around the origin and lies in the x-z
> plane, then
> the distance from any point (x,y,z) to the nearest point on the circle
> will
> be:
> 
>   sqrt( y*y + (sqrt(x*x+z*z)-1)*(sqrt(x*x+z*z)-1) )
> 
> Regards,
> John"
> 
> I needed it for a ring of cigarette smoke, but it does make cool neon,
> too.
> 
> Have fun.
> 
> Peter Popov
> ICQ: 15002700

Cool, I thought that there would be a fairly straight forward way to
calculate it.  Hmm. now maybe I'll even try to implement it.

Cheers, PoD.


Post a reply to this message

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