Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Isocontour.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the
00004  *cr                        University of Illinois
00005  *cr                         All Rights Reserved
00006  *cr
00007  ***************************************************************************/
00008 
00009 #ifndef ISOCONTOUR_H
00010 #define ISOCONTOUR_H
00011 
00012 #include "BaseMolecule.h"
00013 #include "ResizeArray.h"
00014 
00016 typedef struct {
00017    float x;
00018    float y;
00019 } XY;
00020 
00022 typedef struct {
00023    XY p[2];     
00024 } LINE;
00025 
00027 typedef struct {
00028    XY p[4];     
00029    float val[4]; 
00030    int cubeindex;
00031 } SQUARECELL;
00032 
00034 class IsoContour {
00035  public:
00036    int numtriangles;              
00037    ResizeArray<float>  v;         
00038    ResizeArray<int>    f;         
00039    const VolumetricData * vol;    
00040    float xax[3], yax[3], zax[3];  
00041 
00042  public:
00043    IsoContour(); 
00044 
00046    int compute(const VolumetricData *, float isovalue, int step); 
00047 
00048    void clear(); 
00049 
00050  /* private: */
00051  public:
00052    int DoCell(int x, int y, int z, float isovalue, int step);
00053    int Polygonise(const SQUARECELL grid, const float isolevel, LINE *lines);
00054    void VertexInterp(float isolevel, const SQUARECELL grid, int ind1, int ind2, XY *vert); 
00055 };
00056 
00057 
00058 #if defined(ISOCONTOUR_INTERNAL)
00059 
00060 static int edgeTable[16]={
00061 0x0  , 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,
00062 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0   };
00063 
00064 int lineTable[16][16] =
00065 {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00066  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00067  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00068  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00069  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00070  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00071  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00072  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00073  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00074  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00075  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00076  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00077  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00078  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00079  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
00080  {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}};
00081 
00082 #endif
00083 
00084 #endif

Generated on Fri Oct 4 02:44:09 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002