That's basically it.
Sam, the key is that the method uses the Marching Cubes algorithm with a
VERY specific sequence of checking vertices. No vertex is ever checked
twice, but you have to get it exactly right. My Jmol Java implementation of
Marching Cubes is at
http://jmol.svn.sourceforge.net/viewvc/jmol/trunk/Jmol/src/org/jmol/jvxl/calc/MarchingCubes.java
That expects a BitSet indicating the in/out nature of the vertices coming
from the decoder. The decoding is done in
http://jmol.svn.sourceforge.net/viewvc/jmol/trunk/Jmol/src/org/jmol/jvxl/readers/JvxlReader.java
where the actual decoding from integers in the file to a BitSet is in the
following method. nPoints integers are expected in the file.
protected BitSet getVoxelBitSet(int nPoints) throws Exception {
BitSet bs = new BitSet();
int bsVoxelPtr = 0;
if (surfaceDataCount <= 0)
return bs; //unnecessary -- probably a plane
int nThisValue = 0;
while (bsVoxelPtr < nPoints) {
nThisValue = parseInt();
if (nThisValue == Integer.MIN_VALUE) {
line = br.readLine();
// note -- does not allow for empty lines;
// must be a continuous block of numbers.
if (line == null || (nThisValue = parseInt(line)) ==
Integer.MIN_VALUE) {
if (!endOfData)
Logger.error("end of file in JvxlReader?" + " line=" + line);
endOfData = true;
nThisValue = 10000;
//throw new NullPointerException();
}
}
thisInside = !thisInside;
++jvxlNSurfaceInts;
if (thisInside)
bs.set(bsVoxelPtr, bsVoxelPtr + nThisValue);
bsVoxelPtr += nThisValue;
}
return bs;
}
This method is being called by readSurfaceData(boolean isMapData). Let us
know if you still need help there.
(Please use jmol-developers list for programming issues like this.)
Bob
On Sat, Jul 18, 2009 at 2:52 PM, Sam Bryfczynski <[email protected]> wrote:
> Hello,I like how compact the jvxl format is and would like to use it in my
> own software. However, I am having a bit of trouble wrapping my head around
> how to uncompress it. I've read over the JVXL file pdf which describes the
> format but am left scratching my head a bit. I am mainly confused about
> what the surface voxel bitmap data is. It says you can use it to find the
> "critical edges" but I don't know how. When the document says "We simply
> list the number of voxels found sequentially on each side: 115922 outside, 2
> inside, 6333 outside, 4 insideā¦" what does "on each side" mean? The bottom
> line is I am trying to just get the polygons needed to render the isosurface
> from the jvxl data. Ive been looking at the source code and the JvxlReader
> class and trying to figure out how to best approach this. Any suggestions?
> Thanks,
>
> ----------------------------
> Sam Bryfczynski
> Computer Science
> Clemson University
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Jmol-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
--
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107
If nature does not answer first what we want,
it is better to take what answer we get.
-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users