示例#1
0
// Refine initial guess.
void UAVLocalization::RefineTransformation(const PointCloud::Ptr& target,
                                           const PointCloud::Ptr& source) {
  if (!initialized_) {
    ROS_ERROR("%s: Tried to refine transform before initializing.",
              name_.c_str());
    return;
  }


  // Setup.
  pcl::GeneralizedIterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> icp;
  icp.setInputSource(source);
  icp.setInputTarget(target);
  icp.setMaxCorrespondenceDistance(corr_dist_);
  icp.setMaximumIterations(max_iters_);
  icp.setTransformationEpsilon(tf_epsilon_);
  icp.setRANSACOutlierRejectionThreshold(ransac_thresh_);

  // Align.
  PointCloud aligned_scan;
  icp.align(aligned_scan);

  Transform3D refinement(icp.getFinalTransformation().cast<double>());
  refined_transform_ = refinement * refined_transform_;
}
示例#2
0
void OptionBaseLogPrice<dim>::make_grid(){
        
        std::vector<unsigned> refinement(dim);
        
        for (unsigned i=0; i<dim; ++i) {
                
                this->Smin[i]=log((1-this->f)*(*(this->models[i])).get_spot()*
                exp((this->r-(*(this->models[i])).get_vol()*(*(this->models[i])).get_vol()/2)*
                (this->T)-(*(this->models[i])).get_vol()*sqrt(this->T)*6)/
                ((*(this->models[i])).get_spot()));
                
                this->Smax[i]=log((1+this->f)*(*(this->models[i])).get_spot()*
                exp((this->r-(*(this->models[i])).get_vol()*(*(this->models[i])).get_vol()/2)*
                (this->T)+(*(this->models[i])).get_vol()*sqrt(this->T)*6)/
                ((*(this->models[i])).get_spot()));
                
                refinement[i]=pow(2, this->refs);
        }
        
        GridGenerator::subdivided_hyper_rectangle (this->triangulation, refinement,
                                                   this->Smin, this->Smax);
        
        this->grid_points=this->triangulation.get_vertices();
        
        return;
}