POV-Ray : Newsgroups : povray.binaries.programming : new pattern simulating a wall of interlocking rectangular stones of unequal size : Re: new pattern simulating a wall of interlocking rectangular stones of unequal size Server Time
2 May 2024 17:49:06 EDT (-0400)
  Re: new pattern simulating a wall of interlocking rectangular stones of unequal size  
From: Jim Snow
Date: 13 Jul 2001 15:33:26
Message: <01c10b6e$0a7607a0$86811c26@jmsWin95>
Ron Parker <ron### [at] povrayorg> wrote in article
<slr### [at] fwicom>...
> So, here is my thought:  Pick your seed points the same way crackle picks
> its centroids (except in 2D, obviously.)  For each square, determine the 
> sum of its coordinates.  If that sum is even, make the seed point draw a 
> horizontal line.  If it's odd, make the seed point draw a vertical line. 

> Now, when a mortar line leaves its enclosing square it's likely to meet a

> line going the other way within the next square (unless the line going
the 
> other way was stopped by the line that came from the opposite face of the

> square.)   It's still possible to have infinite lines, but they're very 
> very unlikely.  It's unlikely that a line will make it more than 3
squares
> away, I'd think, meaning you might need to search as many as 50 points
> for each test.  But you should be able to cache the results of those
tests
> to some extent to take advantage of some of the spatial coherence in the
> raytracing algorithm, as the crackle pattern does.
> 
> -- 
> #macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z
a-z)R(a
> -z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F
T)merge{
> P(z+a)P(z-a)R(-z-z-x a)pigment{rgbf 1}hollow interior{media{emission
3-T}}}#end 
> Z(-x-x.2x)camera{location z*-10rotate x*90normal{bumps.02scale.05}}
> 

I thought about alternating verticals and horizontals, but decided it would
make the texture look a little too predictable.  However, the algorithm
could be vastly simplified - instead of testing distance from the
originating points to determine which mortar line wins when they intersect,
I could make it so that a mortar line always wins within its own square and
loses outside its own square.  The search grid would only have to be 3x3 to
garuntee that no line escapes the grid.

Maybe I should try to make a 3d version with the simpler algorithm.

-jim


Post a reply to this message

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