POV-Ray : Newsgroups : povray.general : density_file documentation question Server Time
16 Nov 2024 13:22:52 EST (-0500)
  density_file documentation question (Message 1 to 1 of 1)  
From: Dan Connelly
Subject: density_file documentation question
Date: 11 Jul 1998 20:54:57
Message: <35A7FB45.44FA80CB@flash.net>
From the POV-pi documentation :

  The df3 format consists of a 6 byte header of three 16-bit integers
  with high order byte first. These three values give the x,y,z size of
  the data in pixels (or more appropriately called voxels). This is
  followed by x*y*z unsigned integer bytes of data. The data in the
  range of 0 to 255 is scaled into a float value in the range 0.0 to
  1.0. It remains at 0.0 for all areas beyond the unit cube. The
  pattern occupies the unit cube regardless of the dimensions in voxels.

This doesn't specify the ordering of the voxels...

For example, is the following perl fragment correct?
(I am interested primarily in the ordering : which
variable varies quickly, which slowly?)

print pack ( "NNN", $x_size, $y_size, $z_size );

for ( $x = 0; $x < $x_size; $x ++ ) {
  for ( $y = 0; $y < $y_size; $y ++ ) {
    for ( $z = 0; $z < $z_size; $z ++ ) {
      print pack( "C", $u[$x][$y][$z] );
    }
  }
}


Note: don't use "S" in place of "N" -- "S" produces
system-dependent byte-ordering, as I learned the hard
way....

-- 
http://www.flash.net/~djconnel/


Post a reply to this message

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