Fixes errors in ifc_curve_rebar.cpp

M_PI was not defined,. Replaced it with boost::math::constants::pi<double>

Calculation of area was incorrect. Area of a circle = PI*r*r = PI*dia*dia/4
This commit is contained in:
Richard Brice
2026-01-31 05:30:06 -08:00
parent 9b8b05a570
commit c6257a4b3a
+4 -1
View File
@@ -31,6 +31,9 @@
#include "ifcparse/Ifc2x3.h"
#include "ifcparse/IfcHierarchyHelper.h"
#include <boost/math/constants/constants.hpp>
const static double PI = boost::math::constants::pi<double>();
typedef std::string S;
typedef IfcParse::IfcGlobalId guid;
boost::none_t const null = boost::none;
@@ -41,7 +44,7 @@ void create_curve_rebar(IfcHierarchyHelper<IfcSchema>& file)
int R = 3 * dia;
int length = 12 * dia;
double crossSectionarea = M_PI * (dia / 2) * 2;
double crossSectionarea = PI * dia * dia / 4;
IfcSchema::IfcReinforcingBar* rebar = new IfcSchema::IfcReinforcingBar(
guid(), 0, S("test"), null,
null, 0, 0,