Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

MRVertex.h

Go to the documentation of this file.
00001 /*
00002     File:       MRVertex.h
00003 
00004     Function:   
00005 
00006     Author:     Andrew Willmott, originally from code by Michael Garland,
00007                 but a lot's changed since then =).
00008 
00009     Copyright:  (c) 1997-2000, Andrew Willmott
00010 */
00011 
00012 #ifndef __MRVertex__
00013 #define __MRVertex__
00014 
00015 #include "gcl/Geometry.h"
00016 #include "gcl/Colour.h"
00017 #include "cl/Flags.h"
00018 #include "cl/NArray.h"
00019 
00020 class MRModel;
00021 class MRVertex;
00022 class MRCodes;
00023 
00024 struct FaceIdx
00025 {
00026     Int     v[3];
00027 };
00028 
00029 typedef NArray<FaceIdx> FaceIdxArray;
00030 typedef NArray<MRVertex> MRVertexes;
00031 typedef NArray<MRCodes> MRCodesList;
00032 typedef NArray<UInt32> TreeCodes;
00033 typedef NArray<Flags8> MRFlagsList;
00034 
00035 enum MRV_Flags
00036 {
00037     MRV_Active      = 0x0001,   
00038     MRV_Inside      = 0x0002,   
00039     MRV_FaceActive  = 0x0004,   
00040     MRV_End
00041 };
00042 
00043 class MRVertex
00044 {
00045 public:
00046     MRVertex();
00047 
00048     Bool        IsLeaf()    { return(child[0] < 0); }
00049     Bool        IsRoot()    { return(parent < 0); }
00050 
00051     Void        SetContraction(
00052                     MRVertexes      &vertices,
00053                     Int             iv,
00054                     MRFlagsList     &flags,
00055                     Int             child0, 
00056                     Int             child1,
00057                     Int             face0,
00058                     Int             face1,
00059                     GCLReal         err
00060                 );
00061 
00062     Bool        CanContract(Int iv, MRFlagsList &flags);
00063     Bool        CanExpand(Int iv, MRFlagsList &flags);
00064 
00065     Void        Contract(Int iv, MRFlagsList &flags);
00066     Void        Expand(Int iv, MRFlagsList &flags);
00067 
00068     Void        PrintID();
00069 
00070     Void        PullProps(MRVertexes &vertices);
00071                 // pull face properties up the vertex tree.
00072     
00073     // fields
00074     
00075     Int         parent;         
00076     Int         child[2];       
00077     Int         face[2];        
00078 
00079     Byte        level;          
00080     Vector      areaNormal;     
00081 };
00082 
00083 class MRCodes
00084 {
00085 public:
00086     MRCodes();
00087 
00088     Void        AdjustVertices(MRVertexes &vertices, MRFlagsList &flags,
00089                     Int faceIndexes[3], Int leafIndexes[3]);
00090 
00091                 // set properties of face.
00092 
00093     // fields
00094     UInt32      treeCode[3];
00095 };
00096 
00097 
00122 Void MRSetupHierarchy(
00123         MRVertexes      &vertices, 
00124         Int             iv,
00125         TreeCodes       &treeCodes,
00126         Int             &height,
00127         Int             level,
00128         Int             treeCode
00129     );
00130 
00131 #endif
00132 

Generated at Sat Aug 5 00:17:01 2000 for Graphics Class Library by doxygen 1.1.0 written by Dimitri van Heesch, © 1997-2000