00001 /* 00002 * Copyright (C) 2008 00003 * Robert Bosch LLC 00004 * Research and Technology Center North America 00005 * Palo Alto, California 00006 * 00007 * All rights reserved. 00008 * 00009 *------------------------------------------------------------------------------ 00010 * project ....: PUMA: Probablistic Unsupervised Model Acquisition 00011 * file .......: Vertex3D.h 00012 * authors ....: Benjamin Pitzer 00013 * organization: Robert Bosch LLC 00014 * creation ...: 02/29/2008 00015 * modified ...: $Date:2008-03-03 10:26:02 -0800 (Mon, 03 Mar 2008) $ 00016 * changed by .: $Author:benjaminpitzer $ 00017 * revision ...: $Revision:141 $ 00018 */ 00019 #ifndef VERTEX3D_H_ 00020 #define VERTEX3D_H_ 00021 00022 //== INCLUDES ================================================================== 00023 #include <vector> 00024 #include <rtc/rtcBase.h> 00025 #include <rtc/rtcIOObject.h> 00026 #include <rtc/rtcPoint3D.h> 00027 #include <rtc/rtcVec2.h> 00028 00029 //== NAMESPACES ================================================================ 00030 namespace rtc { 00031 00032 //== FORWARD DECLARATIONS ====================================================== 00033 class Mesh3D; 00034 class Face3D; 00035 00036 #define VERTEX_FLAG_BOUNDARY 0x01 00037 #define VERTEX_FLAG_HIDDEN 0x02 00038 #define VERTEX_FLAG_HAS_TEX_COORD 0x04 00039 #define VERTEX_FLAG_EMPTY3 0x08 00040 #define VERTEX_FLAG_EMPTY4 0x10 00041 #define VERTEX_FLAG_EMPTY5 0x20 00042 #define VERTEX_FLAG_EMPTY6 0x40 00043 #define VERTEX_FLAG_EMPTY7 0x80 00044 00045 00046 //== CLASS DEFINITION ========================================================== 00047 class Vertex3D : public IOObject 00048 { 00049 public: 00050 Vertex3D(Mesh3D* mesh); 00051 Vertex3D(Mesh3D* mesh, const Point3Df& p); 00052 virtual ~Vertex3D(); 00053 // calculate normal vector 00054 void update(); 00055 // copy c'tor 00056 Vertex3D(const Vertex3D& other); 00057 00058 // mutators 00059 void set(Vec3f p); 00060 void set(float x, float y, float z); 00061 00062 // flags 00063 void setFlag(int flag, bool value); 00064 bool getFlag(int flag) const; 00065 bool boundary() const; 00066 void setBoundary(bool boundary); 00067 bool hidden() const; 00068 void setHidden(bool hidden); 00069 bool hasTexCoord() const; 00070 00071 // ASCII stream IO 00072 virtual bool write(OutputHandler &oh) const; 00073 virtual bool read(InputHandler &ih); 00074 void write(FILE *fp) const; 00075 void read(FILE *fp); 00076 00077 Mesh3D* mesh; 00078 Point3Df p; 00079 Vec3f n; 00080 Vec3uc c; 00081 int flags; 00082 std::vector<int> faces; 00083 00084 //texture coordinates 00085 Vec2f t; 00086 }; 00087 00088 //============================================================================== 00089 } // NAMESPACE rtc 00090 //============================================================================== 00091 #endif // VERTEX3D_H_ defined 00092 //==============================================================================