typename beziervolume<point_t>::array_type beziervolume<point_t>::ocsplit ( ) const { array_type result; std::size_t new_size_u = order_u() + degree_u(); std::size_t new_size_v = order_v() + degree_v(); std::size_t new_size_w = order_w() + degree_w(); // generate point-meshes for different steps of split pointmesh3d<point_t> cpsplit_u ( new_size_u, order_v(), order_w() ); pointmesh3d<point_t> cpsplit_uv ( new_size_u, new_size_v, order_w() ); pointmesh3d<point_t> cpsplit_uvw ( new_size_u, new_size_v, new_size_w ); converter<point_t> converter; // split in u for (std::size_t v = 0; v != order_v(); ++v) { for (std::size_t w = 0; w != order_w(); ++w) { // elevate to virtual nurbscurve to apply knot insertion std::vector<point_t> tmp_curve = _points.submesh ( 0, v, w ); // create knot vector std::vector<value_type> kv_min (order_u(), 0); std::vector<value_type> kv_max (order_u(), 1); std::multiset<value_type> kv; kv.insert ( kv_min.begin(), kv_min.end() ); kv.insert ( kv_max.begin(), kv_max.end() ); converter.knot_insertion (tmp_curve, kv, order_u(), value_type(0.5)); cpsplit_u.submesh (tmp_curve.begin(), 0, v, w); } } // split in v for (std::size_t u = 0; u != new_size_u; ++u) { for (std::size_t w = 0; w != order_w(); ++w) { // elevate to virtual nurbscurve to apply knot insertion std::vector<point_t> tmp_curve = cpsplit_u.submesh ( 1, u, w ); // create knot vector std::vector<value_type> kv_min (order_v(), 0); std::vector<value_type> kv_max (order_v(), 1); std::multiset<value_type> kv; kv.insert ( kv_min.begin(), kv_min.end() ); kv.insert ( kv_max.begin(), kv_max.end() ); converter.knot_insertion (tmp_curve, kv, order_v(), value_type(0.5)); cpsplit_uv.submesh (tmp_curve.begin(), 1, u, w); } } // split in w for (std::size_t u = 0; u != new_size_u; ++u) { for (std::size_t v = 0; v != new_size_v; ++v) { // elevate to virtual nurbscurve to apply knot insertion std::vector<point_t> tmp_curve = cpsplit_uv.submesh ( 2, u, v ); // create knot vector std::vector<value_type> kv_min (order_w(), 0); std::vector<value_type> kv_max (order_w(), 1); std::multiset<value_type> kv; kv.insert ( kv_min.begin(), kv_min.end() ); kv.insert ( kv_max.begin(), kv_max.end() ); converter.knot_insertion (tmp_curve, kv, order_w(), value_type(0.5)); cpsplit_uvw.submesh (tmp_curve.begin(), 2, u, v); } } // generate subvolumes for (std::size_t w = 0; w != 2; ++w) { for (std::size_t v = 0; v != 2; ++v) { for (std::size_t u = 0; u != 2; ++u) { pointmesh3d<point_t> submesh = cpsplit_uvw.submesh(u*degree_u(), v*degree_v(), w*degree_w(), order_u(), order_v(), order_w()); beziervolume subvolume (submesh); //result[array_index(u)][array_index(v)][array_index(w)] = subvolume; result[u][v][w] = subvolume; } } } return result; }
void pylt_obj_type_register(PyLiteInterpreter *I, PyLiteTypeObject* type) { if (type->ob_reftype >= kv_max(I->cls_base)) { kv_resize(PyLiteTypeObject*, I->cls_base, type->ob_reftype + 10); }