POV-Ray : Newsgroups : povray.beta-test.binaries : Function / pattern issues. New f_repeat(). : Function / pattern issues. New f_repeat(). Server Time
8 May 2024 12:46:37 EDT (-0400)
  Function / pattern issues. New f_repeat().  
From: William F Pokorny
Date: 2 May 2020 11:22:15
Message: <5ead9027@news.povray.org>
<---------------------- References. Six previous posts

http://news.povray.org/povray.beta-test.binaries/thread/%3C5e9cce19%40news.povray.org%3E/

and

http://news.povray.org/povray.beta-test.binaries/thread/%3C5ea57285%241%40news.povray.org%3E/

---
In povr have implemented a new f_repeat() function which is like the 
existing repeat warp in some respects, but mostly implements some 
SDL/TCL functionality I've had in my toolbox for a while as an inbuilt 
function with the significant improvement of embedding the cells like 
pattern mapping so it need not be calculated and maintained apart.

My toolbox has a bunch of other half done stuff too, but thinking to 
pile it all in one function likely to get sluggish, so leaving that for 
probably another version - f_repeatMoreAndSlower() - or something. :-)

Parameters: x, y, z
Thirteen extra parameter required:
1.  If 0, return new x.
     If 1, return new y.
     If 2, return new z.
     If 3, return matched cells pattern value  0 to 1 interval.
     If 4, return matched cells pattern value -1 to 1 interval.
2.  Count in x.
3.  Count in y.
4.  Count in z.
5.  Delta in x.
6.  Delta in y.
7.  Delta in z.

Direction. If 0, count applied +-. If <0, count applied - only. If >0, count
applied + only.

8.  Direction in x.
9.  Direction in y.
10. Direction in z.
11. Cells pattern offset in x.
12. Cells pattern offset in y.
13. Cells pattern offset in z.

Notes. The base function should be centered at zero and small enough to 
fit in the repeated 'cells.'  The counts too are in both directions 
about the particular axis. So a y count of two means two on each side of 
y. The deltas represent the size of each cell in x,y or z. The 
directions are used to prune counts in particular directions. Lastly, 
the cells offset exists, so if you have multiple instances of the 
isosurface you can make them all look different with respect to textures.

#declare R = 0.070;
#declare cntV   = <+4.0,+1.0,+4.0>;
#declare deltaV = <+0.3,+0.3,+0.3>;
#declare dirV   = <+1.0,+1.0,+0.0>;
#declare coffV  = <+9.0,+9.0,+9.0>;
...

#declare Fn00 = function (x,y,z,r,ax,ay,az,bx,by,bz,cx,cy,cz,dz,dy,dz) {
     f_sphere(
         f_repeat(x,y,z,0,ax,ay,az,bx,by,bz,cx,cy,cz,dz,dy,dz),
         f_repeat(x,y,z,1,ax,ay,az,bx,by,bz,cx,cy,cz,dz,dy,dz),
         f_repeat(x,y,z,2,ax,ay,az,bx,by,bz,cx,cy,cz,dz,dy,dz),
         r
     )
}

#declare Iso98 = isosurface {
     function {
         Fn00(x,y,z,R,
             cntx,cnty,cntz,
             dltx,dlty,dltz,
             dirx,diry,dirz,
             coffx,coffy,coffz
         )
     }
...

#declare Pgm00 = pigment {
     function {
         f_repeat(x,y,z,3,
             cntx,cnty,cntz,
             dltx,dlty,dltz,
             dirx,diry,dirz,
             coffx,coffy,coffz
         )
     }
     raw_wave
     color_map { ColorMap00 }
}

Image attached two isosurfaces though could have been one. Using the 
same pigment for both.

Bill P.


Post a reply to this message


Attachments:
Download 'story_f_repeat.png' (494 KB)

Preview of image 'story_f_repeat.png'
story_f_repeat.png


 

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