MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / create_hcurve

Function create_hcurve

src/examples/IfcAlignment.cpp:110–129  ·  view source on GitHub ↗

creates geometry and business logic segments for horizontal alignment horizonal curves

Source from the content-addressed store, hash-verified

108
109// creates geometry and business logic segments for horizontal alignment horizonal curves
110std::pair<typename Schema::IfcCurveSegment*, typename Schema::IfcAlignmentSegment*> create_hcurve(typename Schema::IfcCartesianPoint* pc, double dir, double radius, double lc) {
111 // geometry
112 double sign = radius / fabs(radius);
113 auto parent_curve = new Schema::IfcCircle(
114 new Schema::IfcAxis2Placement2D(new Schema::IfcCartesianPoint(std::vector<double>({0, 0})), new Schema::IfcDirection(std::vector<double>{1, 0})),
115 fabs(radius));
116
117 auto curve_segment = new Schema::IfcCurveSegment(
118 Schema::IfcTransitionCode::IfcTransitionCode_CONTSAMEGRADIENT,
119 new Schema::IfcAxis2Placement2D(pc, new Schema::IfcDirection(std::vector<double>{cos(dir), sin(dir)})),
120 new Schema::IfcLengthMeasure(0.0),
121 new Schema::IfcLengthMeasure(sign * lc),
122 parent_curve);
123
124 // business logic
125 auto design_parameters = new Schema::IfcAlignmentHorizontalSegment(boost::none, boost::none, pc, dir, radius, radius, lc, boost::none, Schema::IfcAlignmentHorizontalSegmentTypeEnum::IfcAlignmentHorizontalSegmentType_CIRCULARARC);
126 auto alignment_segment = new Schema::IfcAlignmentSegment(IfcParse::IfcGlobalId(), nullptr, boost::none, boost::none, boost::none, nullptr, nullptr, design_parameters);
127
128 return {curve_segment, alignment_segment};
129}
130
131// creates geometry and business logic segments for vertical profile gradient runs
132std::pair<typename Schema::IfcCurveSegment*, typename Schema::IfcAlignmentSegment*> create_gradient(typename Schema::IfcCartesianPoint* p, double slope, double length) {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected