Ignore:
Timestamp:
01/17/08 21:46:32 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.h

    r2575 r2609  
    6262 
    6363/** Mesh containing polygonal patches */ 
    64 class Mesh { 
     64class Mesh  
     65{ 
    6566 
    6667public: 
    6768 
    6869  /// Default constructor 
    69   Mesh():mVertices(), mFaces(), mMaterial(NULL), mKdTree(NULL), mId(0) {} 
     70  Mesh(): mVertices(), mFaces(), mMaterial(NULL), mKdTree(NULL), mId(0) {} 
    7071 
    7172  /// Constructor with container preallocation 
    72   Mesh(const int vertices, const int faces): 
    73     mFaces(), 
    74     mMaterial(NULL), 
    75     mKdTree(NULL), 
    76     mVertices(), 
    77     mIsConvex(false), 
    78     mIsWatertight(false), 
    79         mId(0) 
    80   { 
    81     mVertices.reserve(vertices); 
    82     mFaces.reserve(faces); 
    83   } 
    84  
     73  Mesh(const int vertices, const int faces); 
    8574  /** Constructor setting a unqiue mesh id. 
    8675  */ 
    8776  Mesh(const int id); 
    88  
    8977  /** Setting unique mesh id and using preallocation. 
    9078  */ 
    9179  Mesh(const int id, const int vertices, const int faces); 
    92  
    9380  /** Copy constructor making a deep copy of the faces. 
    9481  */ 
    9582  Mesh(const Mesh &rhs); 
    96  
    9783  /** Assignement operator. 
    9884        @note does not copy id 
     
    116102  void AddFace(Face *face)  
    117103  { 
    118     mFaces.push_back(face); 
     104          mFaces.push_back(face); 
    119105  } 
    120106 
    121107  void ComputeBoundingBox(); 
    122  
    123108  /** This function must be called after creating the mesh 
    124109        because it creates the local kd tree and the bounding box. 
     
    132117  void ApplyTransformation(const Matrix4x4 &m); 
    133118 
    134   /** Axis aligned bounding box of the mesh in local mesh coordinates. 
    135   */ 
    136   AxisAlignedBox3 mBox; 
    137    
    138   /** Vertices forming the mesh. 
    139   */ 
     119  /// Axis aligned bounding box of the mesh in local mesh coordinates. 
     120  AxisAlignedBox3 mBox;  
     121  /// Vertices forming the mesh. 
    140122  VertexContainer mVertices; 
    141    
    142   /** Patches forming the mesh. 
    143   */ 
     123  /// Patches forming the mesh. 
    144124  FaceContainer mFaces; 
    145    
    146   /** Global mesh material. 
    147   */ 
     125  /// Global mesh material. 
    148126  Material *mMaterial; 
    149    
    150   /** true if the mesh is a convex mesh. 
    151   */ 
     127  /// true if the mesh is a convex mesh. 
    152128  bool mIsConvex; 
    153  
    154   /** true if the mesh is a convex mesh. 
    155   */ 
     129  /// true if the mesh is a convex mesh. 
    156130  bool mIsWatertight; 
    157131 
     
    202176  /** Returns unique mesh id. 
    203177  */ 
    204   int GetId() const 
    205   { 
    206           return mId; 
    207   } 
     178  int GetId() const { return mId; } 
    208179 
    209180 
     
    245216 
    246217public: 
    247         MeshInstance(Mesh *mesh):Intersectable(), mMesh(mesh), mMaterial(NULL) 
     218        MeshInstance(Mesh *mesh): Intersectable(), mMesh(mesh), mMaterial(NULL) 
    248219        { 
    249220        } 
     
    315286{ 
    316287public: 
    317   TransformedMeshInstance(Mesh *mesh); 
    318    
    319   virtual AxisAlignedBox3 GetBox() const; 
    320     
    321    
    322   virtual int CastRay(Ray &ray); 
    323  
    324   virtual int CastRay(Ray &ray, const std::vector<int> &faces); 
    325  
    326   virtual int Type() const { return TRANSFORMED_MESH_INSTANCE; } 
    327  
    328   int GetRandomSurfacePoint(Vector3 &point, Vector3 &normal); 
    329  
    330   /** Transforms this mesh instance by m. 
    331   */ 
    332   void ApplyWorldTransform(const Matrix4x4 &m); 
    333  
    334   /** Loads the transformation matrix into this mesh instance. 
    335   */ 
    336   void LoadWorldTransform(const Matrix4x4 &m); 
    337  
    338   /** The transformation is returned in m. 
    339   */ 
    340   void GetWorldTransform(Matrix4x4 &m) const; 
    341  
    342   /** Transforms a mesh according to the stored world transform. 
    343           @param transformedMesh returns the tranformed mesh. 
    344   */ 
    345   void GetTransformedMesh(Mesh &transformedMesh) const; 
    346  
    347   Vector3 GetNormal(const int idx) const; 
     288        TransformedMeshInstance(Mesh *mesh); 
     289 
     290        virtual AxisAlignedBox3 GetBox() const; 
     291 
     292        virtual int CastRay(Ray &ray); 
     293 
     294        virtual int CastRay(Ray &ray, const std::vector<int> &faces); 
     295 
     296        virtual int Type() const { return TRANSFORMED_MESH_INSTANCE; } 
     297 
     298        int GetRandomSurfacePoint(Vector3 &point, Vector3 &normal); 
     299 
     300        /** Transforms this mesh instance by m. 
     301        */ 
     302        void ApplyWorldTransform(const Matrix4x4 &m); 
     303        /** Loads the transformation matrix into this mesh instance. 
     304        */ 
     305        void LoadWorldTransform(const Matrix4x4 &m); 
     306        /** The transformation is returned in m. 
     307        */ 
     308        void GetWorldTransform(Matrix4x4 &m) const; 
     309        /** Transforms a mesh according to the stored world transform. 
     310                @param transformedMesh returns the tranformed mesh. 
     311        */ 
     312        void GetTransformedMesh(Mesh &transformedMesh) const; 
     313 
     314        Vector3 GetNormal(const int idx) const; 
    348315 
    349316protected: 
Note: See TracChangeset for help on using the changeset viewer.