Opened 9 years ago

Last modified 8 years ago

#80 new enhancement

Cave statistics

Reported by: Erin Lynch Owned by: Olly Betts
Priority: minor Milestone:
Component: Other Version:
Keywords: Cc:

Description

In addition to cave length and depth, it would very useful to have aven automatically calculate cave volume, floor area, average passage width, and average passage height using the passage tube data.

In China all of these statistics are required for any cave entered into the national cave database. Automatically calculating them would definitely encourage greater adoption of survex.

Cheers, Erin

Change History (1)

comment:1 Changed 8 years ago by Julian Todd

I've wasted a day implementing a dmp3d parser and ported across GfxCore::SkinPassage?() to generate the areas -- because the outputjson doesn't include those surfaces and I might need them for some webgl application.

https://bitbucket.org/goatchurch/survexprocessing/src/24354eeb4b5b60c75a3871829b7f512018820e56/parse3ddmp.py?fileviewer=file-view-default

Anyways, rather than release some crappy script no one can find and run, I reckon we could fix get this calculation into aven in the following minimal way:

1) Backport the functions that measure the oriented quad pyramid volume:

def vtri(a, b, c):

vb, vc = b - a, c - a n = P3.Cross(vc, vb) nlen = n.Len() if nlen == 0:

return 0

theight = P3.Dot(n, a)/nlen tarea = nlen/2 return theight*tarea/3

def vquad(q0, q1, q2, q3):

return vtri(q0, q1, q2) + vtri(q0, q2, q3)

2) In the function GfxCore::SkinPassage?() aggregate the sum of the vquad(q0, q1, q2, q3) value for every call to (this->*AddQuad?)(q0, q1, q2, q3) and return it as the function value

3) Sum these return values from the calls in GfxCore::GenerateDisplayListTubes?()

4) Put this number somewhere that it can be printed out or looked up by the user.

Can't do this right now because (a) I don't feel this is the most natural place to stash this code yet, and (b) I'm terrible at compiling things and handling git. But other than that it could be something that could be done with minimal impact.

Note: See TracTickets for help on using tickets.