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 15:07:54 EDT (-0400)
  Re: new pattern simulating a wall of interlocking rectangular stones of unequal size  
From: Ron Parker
Date: 13 Jul 2001 11:12:57
Message: <slrn9ku3vq.hs6.ron.parker@fwi.com>
On 13 Jul 2001 04:11:32 -0400, Jim Snow wrote:
>I think that a mortar line can continue infinitely if the points are
>arranged in an "unlucky" fashion.

I'm not convinced that that is true, but proving it either way could be
an interesting project all by itself.

>1.	Pick "random" points within each box such that it is impossible to
>project a vertical or horizontal line through the box without it
>intersecting a mortar line.

This seems like the best solution.  I have some not-very-well-formed thoughts
on this, which I'll elucidate below.

>I'll think about using a noise function for the "random" data - my array of
>random vectors isn't very elegant, even if it is fast.

You might find how the crackle function works interesting.  As you probably
know, the crackle pattern is a 3d voronoi diagram.  Each "stone" has an
apparently randomly positioned centroid, and every point that is closer to
that centroid than to any other is part of that stone.  What isn't so 
obvious on casual examination is that the centroids are not really as 
random as they appear.  All of space is divided into 1x1x1 cubes, and each
cube contains exactly one centroid.  The location of each centroid is 
determined by the values of the Noise3D function at some fixed point within
its enclosing cube, allowing it to be reproducibly calculated as needed.

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}}


Post a reply to this message

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