|
![](/i/fill.gif) |
PoD <pod### [at] merlin net au> 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
|
![](/i/fill.gif) |