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

Method ComputeCurve

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

Source from the content-addressed store, hash-verified

1729 }
1730
1731 void IfcGeometryLoader::ComputeCurve(uint32_t expressID, IfcCurve &curve, const ComputeCurveParams& params) const
1732 {
1733 spdlog::debug("[ComputeCurve({})]", expressID);
1734 auto lineType = _loader.GetLineType(expressID);
1735 switch (lineType)
1736 {
1737 case schema::IFCPOLYLINE:
1738 {
1739 _loader.MoveToArgumentOffset(expressID, 0);
1740 auto points = _loader.GetSetArgument();
1741
1742 for (auto &token : points)
1743 {
1744 uint32_t pointId = _loader.GetRefArgument(token);
1745 if (params.dimensions == 2)
1746 curve.Add(GetCartesianPoint2D(pointId));
1747 else
1748 curve.Add(GetCartesianPoint3D(pointId));
1749 }
1750
1751 if (params.edge)
1752 {
1753 if (params.sameSense == 1 || params.sameSense == -1)
1754 {
1755 std::reverse(curve.points.begin(), curve.points.end());
1756 }
1757 }
1758
1759 break;
1760 }
1761 case schema::IFCCOMPOSITECURVE:
1762 {
1763 // IfcCompositeCurve
1764 // std::vector<IfcSegment> Segments;
1765 // IfcLogical SelfIntersect;
1766
1767 _loader.MoveToArgumentOffset(expressID, 0);
1768 auto segments = _loader.GetSetArgument();
1769 auto selfIntersects = _loader.GetStringArgument();
1770
1771 if (selfIntersects == "T")
1772 {
1773 // TODO: this is probably bad news
1774 spdlog::error("[ComputeCurve()] Self intersecting composite curve {}", expressID);
1775 }
1776
1777 for (size_t ii = 0; ii < segments.size(); ++ii)
1778 {
1779 uint32_t segmentId = _loader.GetRefArgument(segments[ii]);
1780 ComputeCurve(segmentId, curve, params);
1781
1782 #ifdef DEBUG_DUMP_SVG
1783 dump::DumpCurveToHtml(curve.points, "dumpCurve.html");
1784 #endif
1785 }
1786
1787 break;
1788 }

Callers

nothing calls this directly

Calls 15

debugFunction · 0.85
errorFunction · 0.85
DumpCurveToHtmlFunction · 0.85
BuildArc3PtFunction · 0.85
Build3DArc3PtFunction · 0.85
VectorToAngle2DFunction · 0.85
MoveToArgumentOffsetMethod · 0.80
GetSetArgumentMethod · 0.80
GetRefArgumentMethod · 0.80
AddMethod · 0.80
GetStringArgumentMethod · 0.80

Tested by

no test coverage detected