Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. for(unsigned n = 0; n != node["path"].num_elements(); ++n) {
  2. const auto& pt = node["path"][n];
  3. ASSERT_LOG(pt.is_list() && pt.num_elements() > 0, "points in path must be lists of more than one element.");
  4. const double x = pt[0].as_decimal().as_float();
  5. const double y = pt.num_elements() > 1 ? pt[1].as_decimal().as_float() : 0.0;
  6. const double z = pt.num_elements() > 2 ? pt[2].as_decimal().as_float() : 0.0;
  7. points_.emplace_back(x,y,z);
  8. std::cerr << "XXX: POINT: " << x << ", " << y << ", " << z << "\n";
  9. }
  10. spl_ = std::make_shared<geometry::spline3d<float>>(points_);
  11. for(float j = 0; j <= 1.0; j += 0.2) {
  12. std::cerr << "XXX: INTERPOLATE: " << j << ": " << spl_->interpolate(j) << "\n";
  13. }
  14.  
  15. This is the output I get:
  16.  
  17. XXX: POINT: 0, 0, 0
  18. XXX: POINT: 1000, 0, 0
  19. XXX: POINT: 2000, 0, 0
  20. XXX: INTERPOLATE: 0: [0,0,0]
  21. XXX: INTERPOLATE: 0.2: [0.064,1208.06,604.064]
  22. XXX: INTERPOLATE: 0.4: [0.512,1544.51,772.512]
  23. XXX: INTERPOLATE: 0.6: [1136.01,2272.01,1136.01]
  24. XXX: INTERPOLATE: 0.8: [1312.22,2624.22,1312.22]
  25. XXX: INTERPOLATE: 1: [2000,0,0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement