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

Function CrossSectionToObj

src/cpp/test/io_helpers.cpp:506–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504 }
505
506 std::string CrossSectionToObj(const std::vector<webifc::geometry::IfcCrossSections> &geom)
507 {
508 std::stringstream obj;
509
510 for (uint32_t ia = 0; ia < geom.size(); ia++)
511 {
512 for (uint32_t ic = 0; ic < geom[ia].curves.size(); ic++)
513 {
514 for (uint32_t ip = 0; ip < geom[ia].curves[ic].points.size(); ip++)
515 {
516 glm::dvec3 t = glm::dvec4(geom[ia].curves[ic].points[ip].x,geom[ia].curves[ic].points[ip].y, 0, 1);
517 obj << "v " << t.x << " " << t.y << " " << t.z << "\n";
518 }
519 }
520 }
521
522 uint32_t idx = 0;
523
524 for (uint32_t ia = 0; ia < geom.size(); ia++)
525 {
526 for (uint32_t ic = 0; ic < geom[ia].curves.size(); ic++)
527 {
528 for (uint32_t ip = 0; ip < geom[ia].curves[ic].points.size() - 1; ip++)
529 {
530 obj << "l " << (idx) << " " << (idx + 1) << "\n";;
531 idx++;
532 }
533 }
534 }
535
536 return obj.str();
537 }
538
539 Bounds getBounds(std::vector<std::vector<glm::dvec2>> input, glm::dvec2 size, glm::dvec2 offset)
540 {

Callers 1

DumpCrossSectionsFunction · 0.85

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected