POV-Ray : Newsgroups : povray.programming : Cells Pattern : Re: Cells Pattern Server Time
6 Oct 2024 14:09:58 EDT (-0400)
  Re: Cells Pattern  
From: John VanSickle
Date: 10 Nov 2002 06:59:37
Message: <3DCE4A2D.AC259872@hotmail.com>
Slime wrote:
> 
> The function that calculates the cells pattern is as follows:
> 
> static DBL cells_pattern (VECTOR EPoint)
> {
>   int    temp;
>   DBL    tf;
> 
>   temp = POV_GET_OLD_RAND(); /* save current seed */
> 
>   /* select a random value based on the cube from which this came. */
> 
>   /* floor the values, instead of just truncating - this eliminates
> duplicated cells
>   around the axes */
> 
>   POV_SRAND(Hash3d((int)floor(EPoint[X]+Small_Tolerance),
>                    (int)floor(EPoint[Y]+Small_Tolerance),
>                    (int)floor(EPoint[Z]+Small_Tolerance)));
> 
>   tf = FRAND();
> 
>   POV_SRAND(temp);  /* restore */
> 
>   return min(tf, 1.0);
> }
> 
> Why is Small_Tolerance being added to EPoint? That just offsets the
> pattern by a little bit. What's the point?

Probably so that when the cell border is coincident with the surface
being textured there will be no speckling.  This would be the case if
it was applied to a plane facing along a coordiante axis at an
integral distance from the origin.

Regards,
John


Post a reply to this message

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