Calculating statistics from .3d files

David Loeffler dl267 at cam.ac.uk
Wed Sep 1 23:08:20 BST 2004


CUCC recently had a request from the local caving authority in the area 
where we do our expeditions, asking us to provide some statistics about our 
caves. One of these was each cave's horizontal extent - the maximum 
horizontal distance between any two survey stations in that cave. So I 
decided I'd write a widget to calculate this statistic from a .3d image 
file.

What I've come up with is based closely on the current CVS 1.0.31 version 
of 3dtopos.c, which I was using as a template for the code to interface 
with img.c. It reads in a .3d file and outputs the same set of statistics 
that cavern produces at the end of a run (north-south range, east-west 
range, vertical range, number of stations and number of legs) as well as 
the extent measurement. I've enclosed the source code - if you want to try 
it out, just drop it into the src directory and duplicate every line 
relating to 3dtopos.c in Makefile.am with a corresponding line relating to 
cavestats.c (the dependencies are the same except it doesn't need 
namecmp.h).

I'd like to know if there's sufficient interest in this little widget to 
make it part of the standard Survex distribution - aside from the extent 
problem, it also saves needlessly firing up cavern or aven just in order to 
find out how deep something is! (It runs quite quickly - on my machine it 
handles Raucherkarhohle (80km) in slighly less than an eighth of a second, 
compared to 80 seconds to cavern the same thing.)

Is it the feeling of the community that this tool is useful? If so, I can 
spend a little while fiddling it so it uses the messages file rather than 
having its messages hard-coded in, writing a manpage, and testing it on 
pathological cases, after which I'll check it in to CVS; but I'm unwilling 
to do that if nobody else sees a need for it. :-)

David Loeffler




More information about the Survex mailing list