| 183 | } |
| 184 | |
| 185 | int IfcGeom::Representation::Triangulation::addVertex(int item_id, int material_index, double pX, double pY, double pZ) { |
| 186 | const bool convert = settings().get<ifcopenshell::geometry::settings::ConvertBackUnits>().get(); |
| 187 | auto unit_magnitude = settings().get<ifcopenshell::geometry::settings::LengthUnit>().get(); |
| 188 | const double X = convert ? (pX /unit_magnitude) : pX; |
| 189 | const double Y = convert ? (pY /unit_magnitude) : pY; |
| 190 | const double Z = convert ? (pZ /unit_magnitude) : pZ; |
| 191 | int i = (int)verts_.size() / 3; |
| 192 | if (settings().get<ifcopenshell::geometry::settings::WeldVertices>().get()) { |
| 193 | const VertexKey key = std::make_tuple(item_id, material_index, X, Y, Z); |
| 194 | typename VertexKeyMap::const_iterator it = welds.find(key); |
| 195 | if (it != welds.end()) { |
| 196 | // Return index for previously encountered point |
| 197 | return it->second; |
| 198 | } |
| 199 | i = (int)(welds.size() + weld_offset_); |
| 200 | welds[key] = i; |
| 201 | } |
| 202 | verts_.push_back(X); |
| 203 | verts_.push_back(Y); |
| 204 | verts_.push_back(Z); |
| 205 | return i; |
| 206 | } |
| 207 | |
| 208 | void IfcGeom::Representation::Triangulation::registerEdgeCount(int n1, int n2, std::map<std::pair<int, int>, int>& edgecount) { |
| 209 | const Edge e = Edge((std::min)(n1, n2), (std::max)(n1, n2)); |