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

Method Triangulation

src/ifcgeom/IfcGeomRepresentation.cpp:119–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119IfcGeom::Representation::Triangulation::Triangulation(const BRep& shape_model)
120 : Representation(shape_model.settings(), shape_model.entity(), shape_model.id())
121 , weld_offset_(0)
122{
123 for (IfcGeom::ConversionResults::const_iterator iit = shape_model.begin(); iit != shape_model.end(); ++iit) {
124
125 // Don't weld vertices that belong to different items to prevent non-manifold situations.
126 resetWelds();
127
128 int surface_style_id = -1;
129 if (iit->hasStyle()) {
130 auto jt = std::find(materials_.begin(), materials_.end(), iit->StylePtr());
131 if (jt == materials_.end()) {
132 surface_style_id = (int)materials_.size();
133 materials_.push_back(iit->StylePtr());
134 } else {
135 surface_style_id = (int)(jt - materials_.begin());
136 }
137 }
138
139 if (settings().get<ifcopenshell::geometry::settings::ApplyDefaultMaterials>().get() && surface_style_id == -1) {
140 const auto& material = IfcGeom::get_default_style(shape_model.entity());
141 auto mit = std::find(materials_.begin(), materials_.end(), material);
142 if (mit == materials_.end()) {
143 surface_style_id = (int)materials_.size();
144 materials_.push_back(material);
145 } else {
146 surface_style_id = (int)(mit - materials_.begin());
147 }
148 }
149
150 iit->Shape()->Triangulate(settings(), *iit->Placement(), this, iit->ItemId(), surface_style_id);
151 }
152}
153
154/// Generates UVs for a single mesh using box projection.
155/// @todo Very simple impl. Assumes that input vertices and normals match 1:1.

Callers

nothing calls this directly

Calls 9

push_backMethod · 0.80
settingsClass · 0.50
entityMethod · 0.45
idMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
TriangulateMethod · 0.45

Tested by

no test coverage detected