MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / addVertex

Method addVertex

src/ifcgeom/IfcGeomRepresentation.cpp:185–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185int 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
208void 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));

Callers 2

TriangulateMethod · 0.80
TriangulateMethod · 0.80

Calls 6

push_backMethod · 0.80
settingsClass · 0.50
getMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected