POV-Ray : Newsgroups : povray.general : Density file drift based upon interpolation : Density file drift based upon interpolation Server Time
5 Aug 2024 10:21:36 EDT (-0400)
  Density file drift based upon interpolation  
From: William F  Pokorny
Date: 28 Sep 2002 12:33:36
Message: <3D95D9DF.591FBAE4@attglobal.net>
Perhaps the wrong group, but I want to document something I
found.

I discovered while playing with R. Suzuki's density file
patch that when we use any interpolation type but 'no
interpolation' the density becomes vertex centered instead
of voxel centered.  In other words the density specified by
the density file changes position.

With typical density files perhaps this has gone unnoticed,
but if using the density file with isosurfaces  for example,
the density files can be quite small and the shift in
position is very noticeable.

If we want to stay voxel centered for all interpolation
types, we can accomplish it with some code like the
following.  In the density_pattern function, in pattern.cpp,
just ahead of the interpolation switch block we would add:

interpolationType =
(TPat->Vals.Density_File->Interpolation % 10);

if ((interpolationType != NO_INTERPOLATION)
  { Ex -= (0.5 / (DBL)Data->Sx); // Result to voxel center
    Ey -= (0.5 / (DBL)Data->Sx);
    Ez -= (0.5 / (DBL)Data->Sx);
  }

And the switch control statement would be changed to use the
already calculated interpolationType value.

Regards, Bill P.


Post a reply to this message

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