src/vertexmap.cpp

changeset 250
2837b549e616
parent 200
ca23936b455b
child 259
c27612f0eac0
equal deleted inserted replaced
249:37d3c819cafa 250:2837b549e616
114 void VertexMap::build() 114 void VertexMap::build()
115 { 115 {
116 this->map.clear(); 116 this->map.clear();
117 this->vertices.clear(); 117 this->vertices.clear();
118 this->vertexHashes.clear(); 118 this->vertexHashes.clear();
119 for (int i = 0; i < this->model->size(); ++i) 119 for (std::size_t i = 0; i < this->model->size(); ++i)
120 { 120 {
121 const ModelElement& element = this->model->at(i); 121 const ModelElement& element = this->model->at(i);
122 std::optional<glm::mat4> matrix = ifplanar<glm::mat4>( 122 std::optional<glm::mat4> matrix = ifplanar<glm::mat4>(
123 element, 123 element,
124 [](const glm::vec3& p1, const glm::vec3& p2, const glm::vec3& p3) 124 [](const glm::vec3& p1, const glm::vec3& p2, const glm::vec3& p3)
160 float scale = 1.0f; 160 float scale = 1.0f;
161 for (const ModelId objectId : info.objects) 161 for (const ModelId objectId : info.objects)
162 { 162 {
163 const std::optional<int> index = model->find(objectId); 163 const std::optional<int> index = model->find(objectId);
164 if (index.has_value()) { 164 if (index.has_value()) {
165 edges(this->model->at(index.value()), [&](Edge&& edge) 165 edges(this->model->at(unsigned_cast(index.value())), [&](Edge&& edge)
166 { 166 {
167 if (hashVertex(edge.a) == pair.first or hashVertex(edge.b) == pair.first) 167 if (hashVertex(edge.a) == pair.first or hashVertex(edge.b) == pair.first)
168 { 168 {
169 scale = std::min(scale, glm::length(edge.b - edge.a) / 3); 169 scale = std::min(scale, glm::length(edge.b - edge.a) / 3);
170 } 170 }

mercurial