POV-Ray : Newsgroups : povray.binaries.utilities : df3 tools : Re: df3 tools Server Time
16 Apr 2024 09:19:40 EDT (-0400)
  Re: df3 tools  
From: jr
Date: 10 Jul 2018 11:25:00
Message: <web.5b44cea4f63f25ef635cc5ad0@news.povray.org>
a tiny Tcl script to calculate the average density of a given DF3 file,
quickly written to demonstrate .. fringe benefits.  :-)

assumes 'spiral.df3' (from the POV-Ray sources) in the current working directory
(or a link).

jr@crow:1:demo$ c### [at] voxavgtcl
# voxavg.tcl - average density of DF3.

set n  0
set t 0

foreach {x y z v} [read stdin] {
  incr n
  incr t $v
}

set avg [expr {($t + 0.0) / $n}]

puts [format {read %d voxels, total %d, average density %g.} $n $t $avg]


jr@crow:2:demo$ df3util -o tcl list spiral . . | tclsh voxavg.tcl
read 12500 voxels, total 171009, average density 13.6807.



enjoy, jr.


Post a reply to this message

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