Blender  V2.93
VertexRep.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
24 #include "Rep.h"
25 
26 namespace Freestyle {
27 
28 class VertexRep : public Rep {
29  public:
30  inline VertexRep() : Rep()
31  {
32  _vid = 0;
33  _PointSize = 0.0f;
34  }
35 
36  inline VertexRep(real x, real y, real z, int id = 0) : Rep()
37  {
38  _coordinates[0] = x;
39  _coordinates[1] = y;
40  _coordinates[2] = z;
41 
42  _vid = id;
43  _PointSize = 0.0f;
44  }
45 
46  inline ~VertexRep()
47  {
48  }
49 
51  virtual void accept(SceneVisitor &v)
52  {
53  Rep::accept(v);
54  v.visitVertexRep(*this);
55  }
56 
58  virtual void ComputeBBox();
59 
61  inline const int vid() const
62  {
63  return _vid;
64  }
65 
66  inline const real *coordinates() const
67  {
68  return _coordinates;
69  }
70 
71  inline real x() const
72  {
73  return _coordinates[0];
74  }
75 
76  inline real y() const
77  {
78  return _coordinates[1];
79  }
80 
81  inline real z() const
82  {
83  return _coordinates[2];
84  }
85 
86  inline float pointSize() const
87  {
88  return _PointSize;
89  }
90 
92  inline void setVid(int id)
93  {
94  _vid = id;
95  }
96 
97  inline void setX(real x)
98  {
99  _coordinates[0] = x;
100  }
101 
102  inline void setY(real y)
103  {
104  _coordinates[1] = y;
105  }
106 
107  inline void setZ(real z)
108  {
109  _coordinates[2] = z;
110  }
111 
112  inline void setCoordinates(real x, real y, real z)
113  {
114  _coordinates[0] = x;
115  _coordinates[1] = y;
116  _coordinates[2] = z;
117  }
118 
119  inline void setPointSize(float iPointSize)
120  {
121  _PointSize = iPointSize;
122  }
123 
124  private:
125  int _vid; // vertex id
126  real _coordinates[3];
127  float _PointSize;
128 };
129 
130 } /* namespace Freestyle */
Base class for all shapes. Inherits from BasicObjects for references counter management (addRef,...
ATTR_WARN_UNUSED_RESULT const BMVert * v
virtual void accept(SceneVisitor &v)
Definition: Rep.h:108
virtual void accept(SceneVisitor &v)
Definition: VertexRep.h:51
void setX(real x)
Definition: VertexRep.h:97
real x() const
Definition: VertexRep.h:71
void setY(real y)
Definition: VertexRep.h:102
const real * coordinates() const
Definition: VertexRep.h:66
virtual void ComputeBBox()
Definition: VertexRep.cpp:26
void setVid(int id)
Definition: VertexRep.h:92
void setPointSize(float iPointSize)
Definition: VertexRep.h:119
void setCoordinates(real x, real y, real z)
Definition: VertexRep.h:112
float pointSize() const
Definition: VertexRep.h:86
void setZ(real z)
Definition: VertexRep.h:107
real y() const
Definition: VertexRep.h:76
VertexRep(real x, real y, real z, int id=0)
Definition: VertexRep.h:36
const int vid() const
Definition: VertexRep.h:61
real z() const
Definition: VertexRep.h:81
inherits from class Rep
Definition: AppCanvas.cpp:32
double real
Definition: Precision.h:26