POV-Ray : Newsgroups : povray.programming : Location of Noise() and VScale() in source? : Re: Location of Noise() and VScale() in source? Server Time
20 Apr 2024 08:22:46 EDT (-0400)
  Re: Location of Noise() and VScale() in source?  
From: Bald Eagle
Date: 20 Apr 2019 08:20:00
Message: <web.5cbb0e56556276064eec112d0@news.povray.org>
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:

> Hello Bill

Hi TOK, long time no see   :)
Hope you're doing well.

> There's a definition of Noise here:
> https://github.com/POV-Ray/povray/blob/master/source/core/material/noise.h#L196

excellent.
I think with fresh eyes, I see that Noise is a call to PortableNoise - so maybe
that will let me trace the code  :)

inline DBL Noise(const Vector3d& EPoint, int noise_generator) { return
PortableNoise(EPoint, noise_generator); }

> In which file did you see VScale ?

VScale is called from the Turbulence function in texture.cpp

[I don't actually do any real C++, but it looks like "const TURB *Turb" is
declaring use of a constant named TURB which comes from - a class (?) or a
struct (?) or an internal private part of another part of the code called "Turb"
and "dereferences" that with the * ?
Similar later on with "int Octaves=Turb->Octaves;", Lambda and Omega.
I have only the most tenuous grasp of the dot . and arrow -> operators at this
point.]

DBL Turbulence(const VECTOR EPoint, const TURB *Turb, int noise_generator)
{
 int i;
 DBL Lambda, Omega, l, o, value;
 VECTOR temp;
 int Octaves=Turb->Octaves;

 if (noise_generator>1)
 {
  value = (2.0 * Noise(EPoint, noise_generator) - 0.5);
  value = min(max(value,0.0),1.0);
 } else {
  value = Noise(EPoint, noise_generator);
 }

 l = Lambda = Turb->Lambda;
 o = Omega  = Turb->Omega;

 for (i = 2; i <= Octaves; i++)
 {
  VScale(temp,EPoint,l);
  if (noise_generator>1)
   value += o * (2.0 * Noise(temp, noise_generator) - 0.5);
 else
  value += o * Noise(temp, noise_generator);
  if (i < Octaves)
  {
   l *= Lambda;
   o *= Omega;
  }
 }
 return (value);
}

and it resides in /source/backend/math/vector.h

inline void VScale(SNGL_VECT a, const SNGL_VECT b, SNGL k)
{
 a[X] = b[X] * k;
 a[Y] = b[Y] * k;
 a[Z] = b[Z] * k;
}


> BTW: Have you ever tried Midnight Commander ?
> I find it very easy to use when searching through a lot of files.


Nope.  I honestly haven't had the energy and the ability to focus on meticulous
things like this for a while - just so much IRL.
Work, the Plague, car repairs, etc........................................

But I keep hanging on by my fingernails   ;)

I'll take a look at M.C. and see what it's like - thanks for the tip!


Post a reply to this message

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