POV-Ray : Newsgroups : povray.programming : Question about radial pattern : Question about radial pattern Server Time
3 Jul 2024 06:21:32 EDT (-0400)
  Question about radial pattern  
From: Wolfgang Wieser
Date: 25 Feb 2004 07:29:14
Message: <403c951a@news.povray.org>
I just decided to implement some new pattern and stepped over 
the following in pattern.cpp:

/*****************************************************************************
* FUNCTION
*   radial_pattern
[..]
* RETURNS
*   DBL value in the range 0.0 to 1.0
******************************************************************************/

static DBL radial_pattern (VECTOR EPoint)
{
  register DBL value;

  if ((fabs(EPoint[X])<0.001) && (fabs(EPoint[Z])<0.001))
  {  value = 0.25;  }
  else
  {  value = 0.25 + (atan2(EPoint[X],EPoint[Z]) + M_PI) / TWO_M_PI;  }

  return(value);
}

Since atan2() will return values in range -Pi..Pi, the return value 
of the pattern will be in range 0.25 .. 0.25+2*Pi and not in range 
0..1 as stated in the description of the function. 

Wolfgang


Post a reply to this message

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