| 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; |