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

Function create_gradient

src/examples/IfcAlignment.cpp:132–150  ·  view source on GitHub ↗

creates geometry and business logic segments for vertical profile gradient runs

Source from the content-addressed store, hash-verified

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) {
133 // geometry
134 auto parent_curve = new Schema::IfcLine(
135 new Schema::IfcCartesianPoint(std::vector<double>({0, 0})),
136 new Schema::IfcVector(new Schema::IfcDirection(std::vector<double>{1, 0}), 1.0));
137
138 auto curve_segment = new Schema::IfcCurveSegment(
139 Schema::IfcTransitionCode::IfcTransitionCode_CONTSAMEGRADIENT,
140 new Schema::IfcAxis2Placement2D(p, new Schema::IfcDirection(std::vector<double>{sqrt(1 - slope * slope), slope})),
141 new Schema::IfcLengthMeasure(0.0), // start
142 new Schema::IfcLengthMeasure(length),
143 parent_curve);
144
145 // business logic
146 auto design_parameters = new Schema::IfcAlignmentVerticalSegment(boost::none, boost::none, p->Coordinates()[0], length, p->Coordinates()[1], slope, slope, boost::none, Schema::IfcAlignmentVerticalSegmentTypeEnum::IfcAlignmentVerticalSegmentType_CONSTANTGRADIENT);
147 auto alignment_segment = new Schema::IfcAlignmentSegment(IfcParse::IfcGlobalId(), nullptr, boost::none, boost::none, boost::none, nullptr, nullptr, design_parameters);
148
149 return {curve_segment, alignment_segment};
150}
151
152// creates geometry and business logic segments for vertical profile parabolic vertical curves
153std::pair<typename Schema::IfcCurveSegment*, typename Schema::IfcAlignmentSegment*> create_vcurve(typename Schema::IfcCartesianPoint* p, double start_slope, double end_slope, double length) {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected