My Project
brick.cpp
Go to the documentation of this file.
1 #include "stdafx.h"
2 #include "../stdafx.h"
3 #include "brick.h"
4 #include <time.h>
5 
7 {
8  this->color = RGB(255, 255, 255);
9 }
10 
11 Brick::Brick(const Brick& brick)
12 {
13  this->vertex = brick.vertex;
14  this->svertex = brick.svertex;
15  this->faces = brick.faces;
16  this->VNormal = brick.VNormal;
17  this->sVNormal = brick.sVNormal;
18  this->FNormal = brick.FNormal;
19  this->center = brick.center;
20  this->color = brick.color;
21 }
22 
24 {
25  this->vertex = brick.vertex;
26  this->svertex = brick.svertex;
27  this->faces = brick.faces;
28  this->VNormal = brick.VNormal;
29  this->sVNormal = brick.sVNormal;
30  this->FNormal = brick.FNormal;
31  this->center = brick.center;
32  this->color = brick.color;
33 }
34 
36 {
37  this->vertex.clear();
38  this->svertex.clear();
39  this->faces.clear();
40  this->VNormal.clear();
41  this->sVNormal.clear();
42  this->FNormal.clear();
43 }
44 
46 {
47  this->vertex = brick.vertex;
48  this->svertex = brick.svertex;
49  this->faces = brick.faces;
50  this->VNormal = brick.VNormal;
51  this->sVNormal = brick.sVNormal;
52  this->FNormal = brick.FNormal;
53  this->center = brick.center;
54  this->color = brick.color;
55  return *this;
56 }
57 
59 {
60  this->vertex.push_back(v);
61  this->svertex.push_back(v);
62 }
63 
64 void Brick::addFace(Face face)
65 {
66  this->faces.push_back(face);
67  vector<Normal> tmp;
68  for (int i = 0; i < 3; i++)
69  {
70  tmp.push_back(Normal(this->FNormal[face.getNormal() - 1]));
71  face.getNextNormal();
72  }
73  this->VNormal.push_back(tmp);
74  this->sVNormal.push_back(tmp);
75 }
76 
78 {
79  this->FNormal.push_back(normal);
80 }
81 
83 {
84  return this->vertex.size();
85 }
86 
88 {
89  return this->faces.size();
90 }
91 
93 {
94  if (!center)
95  {
96  center = &this->center;
97  }
98 
99  modification->initModification(center);
100 
101 #pragma omp parallel for
102  for(int i = 0; i < this->vertexCount(); i++)
103  {
104  this->vertex[i].modificate(modification, center);
105  }
106 
107  for (int i = 0; i < this->facesCount(); i++)
108  {
109  for (int j = 0; j < 3; j++)
110  {
111  this->VNormal[i][j].modificate(modification, center);
112  }
113  }
114 
115 }
Define vertex consisting 3 double coordinates.
Definition: vertex.h:24
COLORREF color
Definition: brick.h:105
Define face consisting 3 links to vetices.
Definition: face.h:25
~Brick()
Definition: brick.cpp:35
void addNormal(Normal normal)
Definition: brick.cpp:77
Define normal (object container for GVector)
Definition: normal.h:24
Brick archetecture.
Definition: brick.h:25
Model basement.
Brick & operator=(const Brick &brick)
Definition: brick.cpp:45
void addFace(Face face)
Definition: brick.cpp:64
vector< vector< Normal > > VNormal
Definition: brick.h:98
vector< vector< Normal > > sVNormal
Definition: brick.h:99
void addVertex(Vertex v)
Definition: brick.cpp:58
int facesCount()
Definition: brick.cpp:87
Brick()
Definition: brick.cpp:6
virtual void initModification(Vertex *center)=0
int getNormal()
Definition: face.cpp:107
vector< Normal > FNormal
Definition: brick.h:101
vector< Vertex > svertex
Definition: brick.h:96
int getNextNormal()
Definition: face.cpp:112
Vertex center
Definition: brick.h:93
vector< Face > faces
Definition: brick.h:103
vector< Vertex > vertex
Definition: brick.h:95
int vertexCount()
Definition: brick.cpp:82
Base modification object class.
Definition: modification.h:26
virtual void modificate(Modification *modification, Vertex *center) override
Definition: brick.cpp:92