Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(unsigned n = 0; n != node["path"].num_elements(); ++n) {
- const auto& pt = node["path"][n];
- ASSERT_LOG(pt.is_list() && pt.num_elements() > 0, "points in path must be lists of more than one element.");
- const double x = pt[0].as_decimal().as_float();
- const double y = pt.num_elements() > 1 ? pt[1].as_decimal().as_float() : 0.0;
- const double z = pt.num_elements() > 2 ? pt[2].as_decimal().as_float() : 0.0;
- points_.emplace_back(x,y,z);
- std::cerr << "XXX: POINT: " << x << ", " << y << ", " << z << "\n";
- }
- spl_ = std::make_shared<geometry::spline3d<float>>(points_);
- for(float j = 0; j <= 1.0; j += 0.2) {
- std::cerr << "XXX: INTERPOLATE: " << j << ": " << spl_->interpolate(j) << "\n";
- }
- This is the output I get:
- XXX: POINT: 0, 0, 0
- XXX: POINT: 1000, 0, 0
- XXX: POINT: 2000, 0, 0
- XXX: INTERPOLATE: 0: [0,0,0]
- XXX: INTERPOLATE: 0.2: [0.064,1208.06,604.064]
- XXX: INTERPOLATE: 0.4: [0.512,1544.51,772.512]
- XXX: INTERPOLATE: 0.6: [1136.01,2272.01,1136.01]
- XXX: INTERPOLATE: 0.8: [1312.22,2624.22,1312.22]
- XXX: INTERPOLATE: 1: [2000,0,0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement