POV-Ray : Newsgroups : povray.newusers : Isosurface and f_spiral - bug or feature? : Re: Isosurface and f_spiral - bug or feature? Server Time
7 Dec 2024 15:19:38 EST (-0500)
  Re: Isosurface and f_spiral - bug or feature?  
From: Bald Eagle
Date: 29 Sep 2017 13:00:01
Message: <web.59ce7b04808cf402c437ac910@news.povray.org>
This is from the 3.7-stable source:

DBL f_spiral(FPUContext *ctx, DBL *ptr, unsigned int) // 64
{
 DBL r, r2, th, temp;
 /* spiral shape                *
  *                             */
 r = sqrt(PARAM_X * PARAM_X + PARAM_Z * PARAM_Z);
 if ((PARAM_X == 0) && (PARAM_Z == 0))
  PARAM_X = 0.000001;
 th = atan2(PARAM_Z, PARAM_X);
 r = r + PARAM(0) * th / TWO_M_PI;
 r2 = fmod(r, PARAM(0)) - PARAM(0) * 0.5;

 if (PARAM(5) == 1)
  r2 = sqrt(r2 * r2 + PARAM_Y * PARAM_Y);
 else if (PARAM(5) != 0)
 {
  temp = 2 / PARAM(5);
  r2 = pow((pow(fabs(r2), temp) + pow(fabs(PARAM_Y), temp)), 1. / temp);
 }
 else
  r2 = max(fabs(r2), fabs(PARAM_Y));

 r = sqrt(PARAM_X * PARAM_X + PARAM_Y * PARAM_Y + PARAM_Z * PARAM_Z);

 return (-min(PARAM(2) - r, PARAM(1) - min(r2, r)));
}


Post a reply to this message

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