arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

VolytopeStd.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------
00002 //
00003 //   Joe Kniss
00004 //     9-20-02
00005 //                   ________    ____   ___ 
00006 //                  |        \  /    | /  /
00007 //                  +---+     \/     |/  /
00008 //                  +--+|  |\    /|     < 
00009 //                  |  ||  | \  / |  |\  \ 
00010 //                  |      |  \/  |  | \  \ 
00011 //                   \_____|      |__|  \__\
00012 //                       Copyright  2002 
00013 //                      Joe Michael Kniss
00014 //                   <<< jmk@cs.utah.edu >>>
00015 //               "All Your Base are Belong to Us"
00016 //-------------------------------------------------------------------------
00017 
00018 //VolytopeStd.h
00019 
00020 //Some standard Volytopes 
00021 
00022 #ifndef __VOLYTOPE_STANDARD_DOT_H
00023 #define __VOLYTOPE_STANDARD_DOT_H
00024 
00025 #include <volume/Volytope.h>
00026 #include <volume/VolField.h>
00027 
00028 ////////////////////////////////////////////////////////////////////////////
00029 /// Create a Cube Volytope with user specified size and origin.
00030 ///   Defaults to a unit cube centered about (0,0,0)
00031 
00032 class VolyCube : public Volytope {
00033 public:
00034    VolyCube(gutz::vec3f origin = gutz::vec3f_neg_half, 
00035       gutz::vec3f size   = gutz::vec3f_one,
00036       gutz::vec3f lltex  = gutz::vec3f_zero,
00037       gutz::vec3f urtex  = gutz::vec3f_one);
00038 
00039    /// Create a VolyCube from a nrro, you have to add the texture
00040    /// yourself
00041    VolyCube(NrroSP nrro);
00042    /// Creat a VolyCube from a VolField, adds the texture for you
00043    VolyCube(VolFieldSP f, unsigned int brickNum=0);
00044 
00045    VolyCube(const VolyCube &v) : Volytope(v) 
00046    {_origin = v._origin;_size=v._size;}
00047 
00048    virtual ~VolyCube() {}
00049 
00050    virtual void operator=(const VolyCube &v) {Volytope::operator =(v);}
00051 
00052    void        setOrigin(gutz::vec3f origin) {_origin = origin; setDims(_origin,_size);}
00053    gutz::vec3f getOrigin()                   {return _origin;}
00054 
00055    void        setSize(gutz::vec3f size) {_size=size; setDims(_origin,_size);}
00056    gutz::vec3f getSize()                 {return _size;}
00057 
00058    //void        setTexDims(gutz::vec3f ll,   
00059    //                      gutz::vec3f ur)  { _lltex = ll; _urtex = ur; setDims(); }
00060    //gutz::vec3f getLLTexDim() { return _lltex; }
00061    //gutz::vec3f getURTexDim() { return _urtex; }
00062 
00063    virtual void loadField(VolFieldSP f, unsigned int brickNum=0);
00064    virtual void loadNrro(NrroSP n);
00065 
00066 protected:
00067    virtual void writeState(NrroSP n);
00068    virtual void readState(NrroSP n);
00069 
00070 
00071    void setDims(gutz::vec3f origin, gutz::vec3f size);
00072    void setNrroDims(NrroSP n);
00073 
00074    void setTcoords(gutz::vec3f lltex, gutz::vec3f urtex, unsigned int texNum);
00075    /// if texNum == -1, it checks to make sure the texture coordinates are the
00076    /// same, if not, it adds another texture coodinate set
00077    void setNrroTcoords(NrroSP n, int texNum);
00078    bool checkTcoords(gutz::vec3f lltex, gutz::vec3f urtex, unsigned int texNum);
00079 
00080    gutz::vec3f _origin;
00081    gutz::vec3f _size;
00082 };
00083 
00084 typedef gutz::SmartPtr<VolyCube> VolyCubeSP;
00085 
00086 ///////////////////////////////////////////////////////////////
00087 /// a VolyCube factory function
00088 /// create an VolytopeVec from a field
00089 VolytopeVec genVolyCubes(VolFieldSP f);
00090 
00091 //========== NOTES ===========================================
00092 // Standard brick vertex ordering: for cube volytopes
00093 //  
00094 //     (011)        (111)
00095 //       6 +---------+ 7   Where 1's are the size of the brick
00096 //        /|        /|      allong that axis
00097 //       / |       / |
00098 // (001)/  |(101) /  |
00099 //   4 +---------+ 5 |
00100 //     |   |     |   |(110) z axis
00101 //     | 2 +-----+---+ 3    ^   
00102 //     |  /(010) |  /       |   y axis
00103 //     | /       | /        | /
00104 //     |/        |/         |/
00105 //   0 +---------+ 1        +-------> x axis 
00106 //  (000)      (100)
00107 //
00108 
00109 ////////////////////////////////////////////////////////////////////////////
00110 /// Create a Tetrahedron Volytope with user specified size and origin.
00111 ///   Defaults to a unit tet centered about (0,0,0)
00112 
00113 
00114 // TODO: finish this thing, not done!!!!!!
00115 class VolyTet : public Volytope {
00116 public:
00117    VolyTet(gutz::vec3f origin = gutz::vec3f_neg_half, 
00118       gutz::vec3f size   = gutz::vec3f_one);
00119 
00120    VolyTet(gutz::vec3f p0, gutz::vec3f p1,
00121       gutz::vec3f p2, gutz::vec3f p4);
00122 
00123    virtual ~VolyTet(){}
00124 
00125    void        setSize(gutz::vec3f size) {_size=size; setDims();}
00126    gutz::vec3f getSize()                 {return _size;}
00127 
00128    void        setOrigin(gutz::vec3f origin) {_origin = origin; setDims();}
00129    gutz::vec3f getOrigin()                   {return _origin;}
00130 
00131 
00132 protected:
00133 
00134    void setDims();
00135 
00136    gutz::vec3f _origin;
00137    gutz::vec3f _size;
00138 
00139 };
00140 
00141 #endif
00142 

Send questions, comments, and bug reports to:
jmk