POV-Ray : Newsgroups : povray.programming : Cells Pattern : Cells Pattern Server Time
21 Jul 2024 07:23:35 EDT (-0400)
  Cells Pattern  
From: Slime
Date: 10 Nov 2002 02:30:27
Message: <3dce0b13$1@news.povray.org>
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?

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

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