MCPcopy Create free account
hub / github.com/ThatOpen/engine_web-ifc / GetCrossSections3D

Method GetCrossSections3D

src/cpp/web-ifc/geometry/IfcGeometryLoader.cpp:189–491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187 }
188
189 IfcCrossSections IfcGeometryLoader::GetCrossSections3D(uint32_t expressID, bool scaled, glm::dmat4 coordination) const
190 {
191 spdlog::debug("[GetCrossSections3D({})]", expressID);
192 auto lineType = _loader.GetLineType(expressID);
193 IfcCrossSections sections;
194 double scale = 1;
195 if (scaled)
196 {
197 scale = _cache.GetLinearScalingFactor();
198 glm::dvec4 ps = coordination[3];
199 double y = ps[1];
200 double z = -ps[2];
201 ps[1] = z;
202 ps[2] = y;
203 coordination[3] = ps;
204 }
205 switch (lineType)
206 {
207 case schema::IFCSECTIONEDSOLIDHORIZONTAL:
208 {
209 // IfcSectionedSolidHorizontal
210 // IfcCurve Directrix
211 // std::vector<IfcProfileDef> CrossSections
212 // std::vector<IfcAxis2PlacementLinear> CrossSectionPositions
213
214 _loader.MoveToArgumentOffset(expressID, 0);
215 auto DirectrixId = _loader.GetRefArgument();
216
217 // faces
218 _loader.MoveToArgumentOffset(expressID, 1);
219 auto CrossSectionsOffsets = _loader.GetSetArgument();
220
221 // linear position
222 _loader.MoveToArgumentOffset(expressID, 2);
223 auto CrossSectionPositionOffsets = _loader.GetSetArgument();
224
225 IfcCurve Directrix = GetCurve(DirectrixId, 3);
226
227#ifdef DEBUG_DUMP_SVG
228 dump::DumpCurveToHtml(Directrix.points, "Directrix.html");
229#endif
230
231 std::vector<IfcCurve> curves;
232 std::vector<uint32_t> CrossSectionIDs;
233
234 std::map<double, glm::dmat4> mapCrossSectionPositions; // explicit placements from CrossSectionPositions
235 std::unordered_map<uint32_t, std::set<double> > mapCurveToDistanceAlong;
236 std::vector<glm::dmat4> vecCrossSectionPositionsFallback;
237
238 for ( uint32_t offset : CrossSectionPositionOffsets)
239 {
240 auto CrossSectionPositionID = _loader.GetRefArgument(offset);
241 // IfcAxis2PlacementLinear
242 // IfcPoint Location;
243 // IfcDirection Axis; //optional
244 // IfcDirection RefDirection; //optional
245
246 //glm::dmat4 linearPlacement = GetLocalPlacement(expressID) * scale;

Callers 3

GetAllCrossSectionsFunction · 0.80
GetCrossSections3DFunction · 0.80
GetMeshMethod · 0.80

Calls 13

debugFunction · 0.85
DumpCurveToHtmlFunction · 0.85
errorFunction · 0.85
MoveToArgumentOffsetMethod · 0.80
GetRefArgumentMethod · 0.80
GetSetArgumentMethod · 0.80
GetTokenTypeMethod · 0.80
StepBackMethod · 0.80
GetStringArgumentMethod · 0.80
GetDoubleArgumentMethod · 0.80
sizeMethod · 0.80

Tested by 1

GetCrossSections3DFunction · 0.64