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

Function create_tangent

src/examples/IfcAlignment.cpp:86–107  ·  view source on GitHub ↗

creates geometry and business logic segments for horizontal alignment tangent runs

Source from the content-addressed store, hash-verified

84
85// creates geometry and business logic segments for horizontal alignment tangent runs
86std::pair<typename Schema::IfcCurveSegment*, typename Schema::IfcAlignmentSegment*> create_tangent(typename Schema::IfcCartesianPoint* p, double dir, double length) {
87 // geometry
88 auto parent_curve = new Schema::IfcLine(
89 new Schema::IfcCartesianPoint(std::vector<double>({0, 0})),
90 new Schema::IfcVector(new Schema::IfcDirection(std::vector<double>{1.0, 0.0}), 1.0));
91
92 auto curve_segment = new Schema::IfcCurveSegment(
93 Schema::IfcTransitionCode::IfcTransitionCode_CONTSAMEGRADIENT,
94 new Schema::IfcAxis2Placement2D(p, new Schema::IfcDirection(std::vector<double>{cos(dir), sin(dir)})),
95 new Schema::IfcLengthMeasure(0.0), // start
96 new Schema::IfcLengthMeasure(length),
97 parent_curve);
98
99 // business logic
100 auto design_parameters = new Schema::IfcAlignmentHorizontalSegment(
101 boost::none, boost::none, p, dir, 0.0, 0.0, length, boost::none, Schema::IfcAlignmentHorizontalSegmentTypeEnum::IfcAlignmentHorizontalSegmentType_LINE);
102
103 auto alignment_segment = new Schema::IfcAlignmentSegment(
104 IfcParse::IfcGlobalId(), nullptr, boost::none, boost::none, boost::none, nullptr, nullptr, design_parameters);
105
106 return {curve_segment, alignment_segment};
107}
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) {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected