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

FaceEntity.h

00001 /**************************************************************************\
00002  * 
00003  *  FILE: FaceEntity.h
00004  *
00005  *  This source file is part of DIME.
00006  *  Copyright (C) 1998-1999 by Systems In Motion.  All rights reserved.
00007  *
00008  *  This library is free software; you can redistribute it and/or modify it
00009  *  under the terms of the GNU General Public License, version 2, as
00010  *  published by the Free Software Foundation.
00011  *
00012  *  This library is distributed in the hope that it will be useful, but
00013  *  WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  *  General Public License (the accompanying file named COPYING) for more
00016  *  details.
00017  *
00018  **************************************************************************
00019  *
00020  *  If you need DIME for a non-GPL project, contact Systems In Motion
00021  *  to acquire a Professional Edition License:
00022  *
00023  *  Systems In Motion                                   http://www.sim.no/
00024  *  Prof. Brochs gate 6                                       sales@sim.no
00025  *  N-7030 Trondheim                                   Voice: +47 22114160
00026  *  NORWAY                                               Fax: +47 67172912
00027  *
00028 \**************************************************************************/
00029 
00030 #ifndef DIME_FACEENTITY_H
00031 #define DIME_FACEENTITY_H
00032 
00033 #include <dime/Basic.h>
00034 #include <dime/entities/Entity.h>
00035 #include <dime/util/Linear.h>
00036 
00037 class DIME_DLL_API dimeFaceEntity : public dimeEntity 
00038 {
00039 public:
00040   bool isQuad() const;
00041   
00042   virtual bool getRecord(const int groupcode,
00043                          dimeParam &param,
00044                          const int index = 0) const;
00045   
00046   void setVertex(const int idx, const dimeVec3f &v);
00047   void setTriangle(const dimeVec3f &v0, const dimeVec3f &v1,
00048                    const dimeVec3f &v2);
00049   void setQuad(const dimeVec3f &v0, const dimeVec3f &v1,
00050                const dimeVec3f &v2, const dimeVec3f &v3);
00051   const dimeVec3f &getVertex(const int idx) const;
00052   void getVertices(dimeVec3f &v0, dimeVec3f &v1,
00053                    dimeVec3f &v2, dimeVec3f &v3) const;
00054   
00055   virtual dxfdouble getThickness() const;
00056   virtual void getExtrusionDir(dimeVec3f &ed) const;
00057   
00058   GeometryType extractGeometry(dimeArray <dimeVec3f> &verts,
00059                                dimeArray <int> &indices,
00060                                dimeVec3f &extrusionDir,
00061                                dxfdouble &thickness);
00062   
00063   virtual int typeId() const;
00064   virtual bool isOfType(const int thetypeid) const;
00065   virtual int countRecords() const;
00066 
00067 protected:
00068 
00069   virtual bool swapQuadCoords() const;
00070   
00071   virtual bool handleRecord(const int groupcode, 
00072                             const dimeParam &param,
00073                             dimeMemHandler * const memhandler);
00074   void copyCoords(const dimeFaceEntity * const entity);
00075   bool writeCoords(dimeOutput * const file);
00076   
00077   dimeFaceEntity();
00078   dimeVec3f coords[4];
00079 
00080 }; // class dimeFaceEntity
00081 
00082 inline const dimeVec3f &
00083 dimeFaceEntity::getVertex(const int idx) const
00084 {
00085   assert(idx >= 0 && idx < 4);
00086   return this->coords[idx]; 
00087 }
00088 
00089 inline bool
00090 dimeFaceEntity::isQuad() const
00091 {
00092   return (coords[2] != coords[3]);
00093 }
00094 
00095 inline void 
00096 dimeFaceEntity::setVertex(const int idx, const dimeVec3f &v)
00097 {
00098   assert(idx >= 0 && idx < 4);
00099   this->coords[idx] = v;
00100 }
00101 
00102 #endif // ! DIME_FACEENTITY_H
00103 

Copyright © 1998-1999, Systems In Motion <sales@sim.no>. All rights reserved.
System documentation was generated using doxygen.