当前位置: 首页>>代码示例>>C++>>正文


C++ Interpolator类代码示例

本文整理汇总了C++中Interpolator的典型用法代码示例。如果您正苦于以下问题:C++ Interpolator类的具体用法?C++ Interpolator怎么用?C++ Interpolator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Interpolator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetItemText

void KeyListCtrl::OnDurationText(wxCommandEvent& event)
{
	if (m_editing_item == -1)
		return;

	wxString str = GetItemText(m_editing_item);
	long id;
	str.ToLong(&id);

	VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
	if (!vr_frame)
		return;
	Interpolator* interpolator = vr_frame->GetInterpolator();
	if (!interpolator)
		return;

	int index = interpolator->GetKeyIndex(int(id));
	str = m_duration_text->GetValue();
	double duration;
	if (str.ToDouble(&duration))
	{
		interpolator->ChangeDuration(index, duration);
		SetText(m_editing_item, 2, str);
	}
}
开发者ID:takashi310,项目名称:VVD_Viewer,代码行数:25,代码来源:RecorderDlg.cpp

示例2: GetNextItem

void KeyListCtrl::OnAct(wxListEvent &event)
{
	long item = GetNextItem(-1,
		wxLIST_NEXT_ALL,
		wxLIST_STATE_SELECTED);
	if (item == -1)
		return;
	wxString str = GetItemText(item);
	long id;
	str.ToLong(&id);

	VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
	if (!vr_frame)
		return;
	Interpolator* interpolator = vr_frame->GetInterpolator();
	if (!interpolator)
		return;

	int index = interpolator->GetKeyIndex(int(id));
	double time = interpolator->GetKeyTime(index);
	VRenderView* view = vr_frame->GetRecorderDlg()->GetView();
	if (!view)
		view = vr_frame->GetView(0);
	if (view)
	{
		view->m_glview->SetParams(time);
		view->RefreshGL();
	}
}
开发者ID:takashi310,项目名称:VVD_Viewer,代码行数:29,代码来源:RecorderDlg.cpp

示例3: resized_image

void ImageBase::resizeImage( const size_t width, const size_t height, ImageDataType* image )
{
    // Resized image.
    ImageDataType resized_image( width, height );

    // Interpolator.
    Interpolator interpolator;
    interpolator.attach( image );

    const double ratio_width  = m_width / static_cast<double>( width );
    const double ratio_height = m_height / static_cast<double>( height );
    for( size_t j = 0; j < height; j++ )
    {
        const double v = j * ratio_height;
        interpolator.setV( v );

        for( size_t i = 0; i < width; i++ )
        {
            const double u = i * ratio_width;
            interpolator.setU( u );

            typename ImageDataType::PixelType pixel = interpolator();
            resized_image.setPixel( i, j, pixel );
        }
    }

    *image = resized_image;
}
开发者ID:fudy1129,项目名称:kvs,代码行数:28,代码来源:ImageBase.cpp

示例4: HitTest

void KeyListCtrl::OnDragging(wxMouseEvent& event)
{
	wxPoint pos = event.GetPosition();
	int flags = wxLIST_HITTEST_ONITEM;
	long index = HitTest(pos, flags, NULL); // got to use it at last
	if (index >=0 && index != m_editing_item && index != m_dragging_to_item)
	{
		VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
		if (!vr_frame)
			return;
		Interpolator* interpolator = vr_frame->GetInterpolator();
		if (!interpolator)
			return;

		m_dragging_to_item = index;

		//change the content in the interpolator
		if (m_editing_item > m_dragging_to_item)
			interpolator->MoveKeyBefore(m_editing_item, m_dragging_to_item);
		else
			interpolator->MoveKeyAfter(m_editing_item, m_dragging_to_item);

		DeleteItem(m_editing_item);
		InsertItem(m_dragging_to_item, "", 0);
		UpdateText();

		m_editing_item = m_dragging_to_item;
		SetItemState(m_editing_item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
	}
}
开发者ID:takashi310,项目名称:VVD_Viewer,代码行数:30,代码来源:RecorderDlg.cpp

示例5: OnInsKey

void RecorderDlg::OnInsKey(wxCommandEvent &event)
{
	wxString str;
	VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
	if (!vr_frame)
		return;
	Interpolator* interpolator = vr_frame->GetInterpolator();
	if (!interpolator)
		return;
	long item = m_keylist->GetNextItem(-1,
		wxLIST_NEXT_ALL,
		wxLIST_STATE_SELECTED);
	int index = -1;
	if (item != -1)
	{
		str = m_keylist->GetItemText(item);
		long id;
		str.ToLong(&id);
		index = interpolator->GetKeyIndex(id);
	}
	str = m_duration_text->GetValue();
	double duration;
	str.ToDouble(&duration);
	int interpolation = m_interpolation_cmb->GetSelection();
	InsertKey(index, duration, interpolation);

	m_keylist->Update();
	m_keylist->SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
开发者ID:takashi310,项目名称:VVD_Viewer,代码行数:29,代码来源:RecorderDlg.cpp

示例6: DeleteAll

void KeyListCtrl::DeleteAll()
{
	VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
	if (!vr_frame)
		return;
	Interpolator* interpolator = vr_frame->GetInterpolator();
	if (!interpolator)
		return;
	interpolator->Clear();
	Update();
}
开发者ID:takashi310,项目名称:VVD_Viewer,代码行数:11,代码来源:RecorderDlg.cpp

示例7: GetMaxDuration

// static
bool Animation::GetMaxDuration(Interpolator const & interpolator, double & maxDuration)
{
  if (interpolator.IsActive())
  {
    double const duration = interpolator.GetMaxDuration();
    if (duration >= 0.0)
      maxDuration = maxDuration >= 0.0 ? std::max(duration, maxDuration) : duration;
    else
      return false;
  }
  return true;
}
开发者ID:milchakov,项目名称:omim,代码行数:13,代码来源:animation.cpp

示例8: main

int main(int argc, char* argv[])
{
  if(argc != 2)
  {
    std::cerr << "Usage: " << argv[0] 
      << " VOLTAGE" << std::endl <<
      "    VOLTAGE should be a voltage that a Sharp rangefinder can produce." << std::endl << 
      "    Your program will then print out the corresponding distance as per the rangefinder's datasheet."<< std::endl;
    exit(0);
  }

  Interpolator myInterpolator;
  
  //TODO1: 
  //Insert your datapoints here like this:
  //myInterpolator.insertDataPoint(someVoltage1, someDistance1);
  //myInterpolator.insertDataPoint(someVoltage2, someDistance2);
  //myInterpolator.insertDataPoint(someVoltage3, someDistance3);
  //etc...
  myInterpolator.insertDataPoint(2.00, 30);
  myInterpolator.insertDataPoint(1.55, 40);
  myInterpolator.insertDataPoint(1.25, 50);
  myInterpolator.insertDataPoint(1.07, 60);
  myInterpolator.insertDataPoint(0.90, 70);
  myInterpolator.insertDataPoint(0.80, 80);
  myInterpolator.insertDataPoint(0.70, 90);
  myInterpolator.insertDataPoint(0.65, 100);
  myInterpolator.insertDataPoint(0.60, 110);
  myInterpolator.insertDataPoint(0.50, 130);


  // This output is done for you - don't modify it!
  std::cout << myInterpolator.getDistance(atof(argv[1]))<< std::endl;
  return 0;
}
开发者ID:cheehieu,项目名称:robot-search-and-rescue,代码行数:35,代码来源:team5-nguyen-4463833114-lab3.cpp

示例9: LSInterpolator

Interpolator * Interpolator::getAnyInterpolatorFromFile(std::ifstream *in) {
	long placeInFile = in->tellg();
	Interpolator *interpolator;

	interpolator = static_cast<Interpolator *>(new LSInterpolator());
	if(interpolator->initFromStream(in)) {
		return interpolator;
	}
	delete interpolator;
	in->seekg(placeInFile);

	std::cout << "Could not get any interpolator from file\n";
	throw 1;
};
开发者ID:123vipulj,项目名称:Fido,代码行数:14,代码来源:Interpolator.cpp

示例10: setNodeEndBehaviour

void NodeUtil::setNodeEndBehaviour( sg::Node* node, Interpolator::BehaviourType behaviour )
{
	Interpolator* intp = dynamic_cast<Interpolator*>( node->positionController() );
	if ( intp )
		intp->setEndBehaviour( behaviour );

	intp = dynamic_cast<Interpolator*>( node->rotationController() );
	if ( intp )
		intp->setEndBehaviour( behaviour );

	intp = dynamic_cast<Interpolator*>( node->scaleController() );
	if ( intp )
		intp->setEndBehaviour( behaviour );
}
开发者ID:TheRyaz,项目名称:c_reading,代码行数:14,代码来源:NodeUtil.cpp

示例11: process

void MeshProcessor::process(ObjectData* object) {

	//Statusinformationen ausgeben
	cout << "calculating temperature distribution for \"" << object->getName()
			<< "\"..." << endl;

	//Für alle Materialien...
	for (unsigned int i = 0; i < object->getMaterials()->size(); i++) {
		ObjectData::MaterialData* mat = &object->getMaterials()->at(i);
		tetgenio* io = mat->tetgenoutput;

		//ist es nötig, die Punktattributliste freizugeben?
		if (mat->tetgenoutput->numberofpointattributes != 0) {
			delete mat->tetgenoutput->pointattributelist;
		}

		//ist es nötig, die Extrapolationsstatusliste freizugeben?
		if (mat->extrapolated != NULL) {
			delete[] mat->extrapolated;
		}

		//Extrapolationsstatusliste neu erstellen
		mat->extrapolated = new bool[mat->tetgenoutput->numberofpoints];
		//Punktattributliste neu erstellen
		mat->tetgenoutput->numberofpointattributes = NUMBEROFSENSORATTRIBUTES;
		mat->tetgenoutput->pointattributelist =
				new REAL[NUMBEROFSENSORATTRIBUTES
						* mat->tetgenoutput->numberofpoints];

		Interpolator interpolator;
		interpolator.setMode(mat->interpolation_mode);

		//Ermitteln der Werte für alle Punkte...
		for (int j = 0; j < io->numberofpoints; j++) {

			//Statusinformationen ausgeben
			cout << "\rmaterial " << i + 1 << ": " << j + 1 << "/"
					<< io->numberofpoints << endl;

			SensorData* sd = &object->getSensorDataList()->at(
					object->getCurrentSensorIndex());
			interpolatePoint(mat, &sd->data.at(sd->current_time_index), j,
					&interpolator);
		}

		cout << endl;
	}
}
开发者ID:vroland,项目名称:SimpleAnalyzer,代码行数:48,代码来源:MeshProcessor.cpp

示例12: SmileSection

 InterpolatedSmileSection<Interpolator>::InterpolatedSmileSection(
                        const Date& d,
                        const std::vector<Rate>& strikes,
                        const std::vector<Real>& stdDevs,
                        Real atmLevel,
                        const DayCounter& dc,
                        const Interpolator& interpolator,
                        const Date& referenceDate,
                        const Real shift)
 : SmileSection(d, dc, referenceDate, ShiftedLognormal, shift),
   exerciseTimeSquareRoot_(std::sqrt(exerciseTime())), strikes_(strikes),
   stdDevHandles_(stdDevs.size()), vols_(stdDevs.size())
 {
     //fill dummy handles to allow generic handle-based
     // computations later on
     for (Size i=0; i<stdDevs.size(); ++i)
         stdDevHandles_[i] = Handle<Quote>(boost::shared_ptr<Quote>(new
             SimpleQuote(stdDevs[i])));
     atmLevel_ = Handle<Quote>
        (boost::shared_ptr<Quote>(new SimpleQuote(atmLevel)));
     // check strikes!!!!!!!!!!!!!!!!!!!!
     interpolation_ = interpolator.interpolate(strikes_.begin(),
                                               strikes_.end(),
                                               vols_.begin());
 }
开发者ID:21hub,项目名称:QuantLib,代码行数:25,代码来源:interpolatedsmilesection.hpp

示例13: setInterpolation

 void setInterpolation(const Interpolator& i = Interpolator()) {
     varianceSurface_ =
         i.interpolate(times_.begin(), times_.end(),
                       strikes_.begin(), strikes_.end(),
                       variances_);
     notifyObservers();
 }
开发者ID:21hub,项目名称:QuantLib,代码行数:7,代码来源:blackvariancesurface.hpp

示例14: setInterpolation

 void setInterpolation(const Interpolator& i = Interpolator()) {
     for (Size j=0; j < times_.size(); ++j) {
         localVolInterpol_[j] = i.interpolate(
             strikes_[j]->begin(), strikes_[j]->end(),
             localVolMatrix_->column_begin(j));
     }
     notifyObservers();
 }
开发者ID:grantathon,项目名称:nquantlib64,代码行数:8,代码来源:fixedlocalvolsurface.hpp

示例15: main

int main () 
{
    
  Region        reg;  
  Constants     con;
  Exodus_file   exo;
  Driver        drv;
  Model_file    mod;
  Utilities     utl;
  Discontinuity dis;
  
  std::cout << "Begin model building." << std::endl;  
      
  // Read parameter file.
  drv.initialize ( mod, dis, utl, exo, reg );  
  drv.checkUsage ( mod, "INTERPOLATE" );
      
  std::cout << "\n----- Interpolating -----\n";
  std::cout << "\n";
  
  dis.createKDTreePacked ( );
  
  for ( std::vector < Exodus_file > :: 
    iterator exoFile=reg.regionsExo.begin();
    exoFile!=reg.regionsExo.end(); ++exoFile )       
  {  
      
    std::cout << "\n";

    Mesh msh;
    Interpolator ipl;    
  
    exoFile -> openFile      ( exoFile -> fname );        
    msh.getInfo              ( exoFile -> idexo );  
    mod.createKDTreeUnpacked ( msh );       
    ipl.interpolate          ( msh, mod, dis );
    exoFile -> writeParams   ( msh );
    exoFile -> closeFile     ( );     
    msh.deallocateMesh       ( mod );
    mod.deallocate           ( );
    
  }
  
  drv.report ( mod );              
  return 0;    
}
开发者ID:michael-afanasiev,项目名称:CEMCXX,代码行数:46,代码来源:Interpolate.cpp


注:本文中的Interpolator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。