MCPcopy Create free account
hub / github.com/BIMCoderLiang/LNLib / ToCAPI

Function ToCAPI

dotnet/CAPI/include/NurbsCurve_CAPI.h:267–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267inline LN_NurbsCurve_C ToCAPI(const LNLib::LN_NurbsCurve& s) {
268 static thread_local std::vector<double> g_knot_buffer;
269 static thread_local std::vector<LNLib::XYZW> g_cp_2d_buffer;
270 static thread_local std::vector<XYZW_C> g_cp_flat_buffer;
271
272 g_knot_buffer = s.KnotVector;
273 g_cp_2d_buffer = s.ControlPoints;
274 g_cp_flat_buffer.clear();
275 g_cp_flat_buffer.reserve(g_cp_2d_buffer.size());
276 for (const auto& cp : g_cp_2d_buffer) {
277 g_cp_flat_buffer.push_back({ cp.WX(), cp.WY(), cp.WZ(), cp.W() });
278 }
279
280 LN_NurbsCurve_C c;
281 c.degree = s.Degree;
282 c.knot_vector = g_knot_buffer.data();
283 c.knot_vector_count = static_cast<int>(g_knot_buffer.size());
284 c.control_points = g_cp_flat_buffer.data();
285 c.control_point_count = static_cast<int>(g_cp_flat_buffer.size());
286 return c;
287}
288#endif

Callers

nothing calls this directly

Calls 4

WXMethod · 0.80
WYMethod · 0.80
WZMethod · 0.80
WMethod · 0.45

Tested by

no test coverage detected