FaceEntity.h
1 /**************************************************************************\
2  *
3  * FILE: FaceEntity.h
4  *
5  * This source file is part of DIME.
6  * Copyright (C) 1998-1999 by Systems In Motion. All rights reserved.
7  *
8  * This library is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License, version 2, as
10  * published by the Free Software Foundation.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License (the accompanying file named COPYING) for more
16  * details.
17  *
18  **************************************************************************
19  *
20  * If you need DIME for a non-GPL project, contact Systems In Motion
21  * to acquire a Professional Edition License:
22  *
23  * Systems In Motion http://www.sim.no/
24  * Prof. Brochs gate 6 sales@sim.no
25  * N-7030 Trondheim Voice: +47 22114160
26  * NORWAY Fax: +47 67172912
27  *
28 \**************************************************************************/
29 
30 #ifndef DIME_FACEENTITY_H
31 #define DIME_FACEENTITY_H
32 
33 #include <dime/Basic.h>
34 #include <dime/entities/Entity.h>
35 #include <dime/util/Linear.h>
36 
37 class DIME_DLL_API dimeFaceEntity : public dimeEntity
38 {
39 public:
40  bool isQuad() const;
41 
42  virtual bool getRecord(const int groupcode,
43  dimeParam &param,
44  const int index = 0) const;
45 
46  void setVertex(const int idx, const dimeVec3f &v);
47  void setTriangle(const dimeVec3f &v0, const dimeVec3f &v1,
48  const dimeVec3f &v2);
49  void setQuad(const dimeVec3f &v0, const dimeVec3f &v1,
50  const dimeVec3f &v2, const dimeVec3f &v3);
51  const dimeVec3f &getVertex(const int idx) const;
52  void getVertices(dimeVec3f &v0, dimeVec3f &v1,
53  dimeVec3f &v2, dimeVec3f &v3) const;
54 
55  virtual dxfdouble getThickness() const;
56  virtual void getExtrusionDir(dimeVec3f &ed) const;
57 
58  GeometryType extractGeometry(dimeArray <dimeVec3f> &verts,
59  dimeArray <int> &indices,
60  dimeVec3f &extrusionDir,
61  dxfdouble &thickness);
62 
63  virtual int typeId() const;
64  virtual bool isOfType(const int thetypeid) const;
65  virtual int countRecords() const;
66 
67 protected:
68 
69  virtual bool swapQuadCoords() const;
70 
71  virtual bool handleRecord(const int groupcode,
72  const dimeParam &param,
73  dimeMemHandler * const memhandler);
74  void copyCoords(const dimeFaceEntity * const entity);
75  bool writeCoords(dimeOutput * const file);
76 
78  dimeVec3f coords[4];
79 
80 }; // class dimeFaceEntity
81 
82 inline const dimeVec3f &
83 dimeFaceEntity::getVertex(const int idx) const
84 {
85  assert(idx >= 0 && idx < 4);
86  return this->coords[idx];
87 }
88 
89 inline bool
90 dimeFaceEntity::isQuad() const
91 {
92  return (coords[2] != coords[3]);
93 }
94 
95 inline void
96 dimeFaceEntity::setVertex(const int idx, const dimeVec3f &v)
97 {
98  assert(idx >= 0 && idx < 4);
99  this->coords[idx] = v;
100 }
101 
102 #endif // ! DIME_FACEENTITY_H
103 

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