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

Function create_vcurve

src/examples/IfcAlignment.cpp:153–178  ·  view source on GitHub ↗

creates geometry and business logic segments for vertical profile parabolic vertical curves

Source from the content-addressed store, hash-verified

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) {
154 // geometry
155 double A = p->Coordinates()[1];
156 double B = start_slope;
157 double C = (end_slope - start_slope) / (2 * length);
158
159 auto parent_curve = new Schema::IfcPolynomialCurve(
160 new Schema::IfcAxis2Placement2D(new Schema::IfcCartesianPoint(std::vector<double>{0.0, 0.0}), new Schema::IfcDirection(std::vector<double>{1.0, 0.0})),
161 std::vector<double>{0.0, 1.0},
162 std::vector<double>{A, B, C},
163 boost::none);
164
165 auto curve_segment = new Schema::IfcCurveSegment(
166 Schema::IfcTransitionCode::IfcTransitionCode_CONTSAMEGRADIENT,
167 new Schema::IfcAxis2Placement2D(p, new Schema::IfcDirection(std::vector<double>{sqrt(1 - start_slope * start_slope), start_slope})),
168 new Schema::IfcLengthMeasure(0.0),
169 new Schema::IfcLengthMeasure(length),
170 parent_curve);
171
172 // business logic
173 double k = (end_slope - start_slope) / length;
174 auto design_parameters = new Schema::IfcAlignmentVerticalSegment(boost::none, boost::none, p->Coordinates()[0], length, p->Coordinates()[1], start_slope, end_slope, 1 / k, Schema::IfcAlignmentVerticalSegmentTypeEnum::IfcAlignmentVerticalSegmentType_PARABOLICARC);
175 auto alignment_segment = new Schema::IfcAlignmentSegment(IfcParse::IfcGlobalId(), nullptr, boost::none, boost::none, boost::none, nullptr, nullptr, design_parameters);
176
177 return {curve_segment, alignment_segment};
178}
179
180// creates representations for each IfcAlignmentSegment per CT 4.1.7.1.1.4
181// https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/concepts/Product_Shape/Product_Geometric_Representation/Alignment_Geometry/Alignment_Geometry_-_Segments/content.html

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected