• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Interpolate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PI4D_SetFraction

static void PI4D_SetFraction(GF_Node *node, GF_Route *route)
{
	u32 i;
	Fixed frac;
	M_PositionInterpolator4D *_this = (M_PositionInterpolator4D *)node;

	if (! _this->key.count) return;
	if (_this->keyValue.count != _this->key.count) return;

	// The given fraction is less than the specified range
	if (_this->set_fraction < _this->key.vals[0]) {
		_this->value_changed = _this->keyValue.vals[0];
	} else if (_this->set_fraction >= _this->key.vals[_this->key.count-1]) {
		_this->value_changed = _this->keyValue.vals[_this->keyValue.count-1];
	} else {
		for (i=1; i<_this->key.count; i++) {
			// Find the key values the fraction lies between
			if (_this->set_fraction < _this->key.vals[i-1]) continue;
			if (_this->set_fraction >= _this->key.vals[i]) continue;

			frac = GetInterpolateFraction(_this->key.vals[i-1], _this->key.vals[i], _this->set_fraction);
			_this->value_changed.x = Interpolate(_this->keyValue.vals[i-1].x, _this->keyValue.vals[i].x, frac);
			_this->value_changed.y = Interpolate(_this->keyValue.vals[i-1].y, _this->keyValue.vals[i].y, frac);
			_this->value_changed.z = Interpolate(_this->keyValue.vals[i-1].z, _this->keyValue.vals[i].z, frac);
			_this->value_changed.q = Interpolate(_this->keyValue.vals[i-1].q, _this->keyValue.vals[i].q, frac);
			break;
		}
	}
	gf_node_event_out(node, 3);//"value_changed"
}
开发者ID:ARSekkat,项目名称:gpac,代码行数:30,代码来源:vrml_interpolators.c


示例2: Interpolate

///==========================================================================================================================================
/// Friend Functions
///==========================================================================================================================================
inline const AABB3D Interpolate(const AABB3D& start, const AABB3D& end, float fractionFromStartToEnd){
	const Vec3 interpolatedMins = Interpolate(start.mins, end.mins, fractionFromStartToEnd);
	const Vec3 interpolatedMaxs = Interpolate(start.maxs, end.maxs, fractionFromStartToEnd);

	AABB3D interpolation(interpolatedMins, interpolatedMaxs);
	return interpolation;
}
开发者ID:asocha,项目名称:Engine,代码行数:10,代码来源:AABB3D.hpp


示例3: max

void CBulletTime::Update()
{
	if (!(g_pGameCVars->bt_speed || g_pGameCVars->bt_ironsight) || gEnv->bMultiplayer)
		return;

	// normalized frametime
	float frameTime = gEnv->pTimer->GetFrameTime();
	float normFrameTime = frameTime;
	float timeScale = gEnv->pTimer->GetTimeScale();
	if (timeScale < 1.0f)
	{
		timeScale = max(0.0001f, timeScale);
		normFrameTime = frameTime/timeScale;
	}

	if (m_active)
	{
		Interpolate(m_energy, 0.0f, g_pGameCVars->bt_energy_decay, normFrameTime);
		// deactivate when we run out of energy
		if (m_energy < 0.001f)
		{
			Activate(false);
		}
	}
	else
	{
		Interpolate(m_energy, g_pGameCVars->bt_energy_max, g_pGameCVars->bt_energy_regen, normFrameTime);
	}

	Interpolate(m_timeScaleCurrent, m_timeScaleTarget, 2.0f, normFrameTime);
	gEnv->pTimer->SetTimeScale(m_timeScaleCurrent);
}
开发者ID:AiYong,项目名称:CryGame,代码行数:32,代码来源:BulletTime.cpp


示例4: PosInt_SetFraction

void PosInt_SetFraction(SFNode *node)
{
	u32 i;
	Float frac;
	M_PositionInterpolator *_this = (M_PositionInterpolator *)node;

	if (! _this->key.count) return;
	if (_this->keyValue.count != _this->key.count) return;
	
	// The given fraction is less than the specified range
	if (_this->set_fraction < _this->key.vals[0]) {
		_this->value_changed = _this->keyValue.vals[0];
	} else if (_this->set_fraction >= _this->key.vals[_this->key.count-1]) {
		_this->value_changed = _this->keyValue.vals[_this->keyValue.count-1];
	} else {
		for (i=1; i<_this->key.count; i++) {
			// Find the key values the fraction lies between
			if (_this->set_fraction < _this->key.vals[i-1]) continue;
			if (_this->set_fraction >= _this->key.vals[i]) continue;

			frac = GetInterpolateFraction(_this->key.vals[i-1], _this->key.vals[i], _this->set_fraction);
			_this->value_changed.x = Interpolate(_this->keyValue.vals[i-1].x, _this->keyValue.vals[i].x, frac);
			_this->value_changed.y = Interpolate(_this->keyValue.vals[i-1].y, _this->keyValue.vals[i].y, frac);
			_this->value_changed.z = Interpolate(_this->keyValue.vals[i-1].z, _this->keyValue.vals[i].z, frac);
			break;
		}
	}
	Node_OnEventOutSTR(node, "value_changed");
}
开发者ID:DmitrySigaev,项目名称:DSMedia,代码行数:29,代码来源:vrml_interpolators.c


示例5: sample_interpolation_main

/**
This function allows to get the prediction of an non IDR picture. 
//8.4.2.2


@param DpbLuma Table of the reference decoded picture buffer.
@param DpbCb Table of the reference decoded picture buffer.
@param DpbCr Table of the reference decoded picture buffer.
@param Luma_l0 Table of current frame.
@param Luma_l1 Table of current frame.
@param Chroma_Cb_l0 Table of current frame.
@param Chroma_Cb_l1 Table of current frame.
@param Chroma_Cr_l0 Table of current frame.
@param Chroma_Cr_l1 Table of current frame.
@param mvL0 The motion vector are stocked for each 4x4 block of each macroblock.
@param mvL1 The motion vector are stocked for each 4x4 block of each macroblock.
@param ref_cache_l0 A cache table where the reference is stocked for each 4x4 block of each macroblock.
@param ref_cache_l1 A cache table where the reference is stocked for each 4x4 block of each macroblock.
@param x X-coordinate.
@param y Y-coordinate.
@param PicWidthInPix Width in pixel of the current frame.
@param PicHeightInPix Height in pixel of the current frame.
@prama RefPicListL0 List l0 of reference image.
@prama RefPicListL1 List l1 of reference image.
@param interpol Function pointer of 4x4 interpoaltion.
*/
void sample_interpolation_main(unsigned char *DpbLuma, unsigned char *DpbCb,unsigned char *DpbCr, 
							   unsigned char *Luma_l0, unsigned char *Luma_l1 , unsigned char *Chroma_Cb_l0, 
							   unsigned char *Chroma_Cb_l1, unsigned char *Chroma_Cr_l0 , unsigned char *Chroma_Cr_l1, 
							   short mvL0[][2], short mvL1[][2], short *ref_cache_l0, short *ref_cache_l1, short x, short y,
							   const short PicWidthInPix, const short PicHeightInPix , const LIST_MMO *RefPicListL0, 
							   const LIST_MMO * RefPicListL1, const interpol_4x4 *interpol)
{

	int i;


	for( i = 0; i < 16; i++){
		short index8 = SCAN8(i);
		const short Currentx = x + LOCX(i);
		const short Currenty = y + LOCY(i);

		if ( ref_cache_l0[index8] >= 0){
			 Interpolate(ref_cache_l0[index8], Currentx, Currenty, &mvL0[index8][0], 4, PicWidthInPix, PicHeightInPix, RefPicListL0, 
				 &Luma_l0[i << 4], &Chroma_Cb_l0[i << 2], &Chroma_Cr_l0[i << 2], DpbLuma, DpbCb, DpbCr, interpol);
		}

		if ( ref_cache_l1[index8] >= 0){
			 Interpolate(ref_cache_l1[index8], Currentx, Currenty, &mvL1[index8][0], 4, PicWidthInPix, PicHeightInPix, RefPicListL1, 
				 &Luma_l1[i << 4], &Chroma_Cb_l1[i << 2], &Chroma_Cr_l1[i << 2], DpbLuma, DpbCb, DpbCr, interpol);
		}
	}	
}
开发者ID:Bevara,项目名称:extra_libs_open,代码行数:53,代码来源:interpolation_main.c


示例6: Interpolate

inline const Vector4< primitiveType > Interpolate( const Vector4< primitiveType >& start, const Vector4< primitiveType >& end, primitiveType fractionFromStartToEnd )
{
    primitiveType xInterpolated = Interpolate( start.x, end.x, fractionFromStartToEnd );
    primitiveType yInterpolated = Interpolate( start.y, end.y, fractionFromStartToEnd );
    primitiveType zInterpolated = Interpolate( start.z, end.z, fractionFromStartToEnd );
    primitiveType wInterpolated = Interpolate( start.w, end.w, fractionFromStartToEnd );
    return Vector4< primitiveType >( xInterpolated, yInterpolated, zInterpolated, wInterpolated );
}
开发者ID:tbgeorge,项目名称:putty_engine,代码行数:8,代码来源:Vector4.hpp


示例7: Interpolate

inline Color Interpolate(Color val1, Color val2, double dDelta)
{
   return Color(
      Interpolate(val1.m_color[Color::red],    val2.m_color[Color::red],    dDelta),
      Interpolate(val1.m_color[Color::green],  val2.m_color[Color::green],  dDelta),
      Interpolate(val1.m_color[Color::blue],   val2.m_color[Color::blue],   dDelta),
      Interpolate(val1.m_color[Color::alpha],  val2.m_color[Color::alpha],  dDelta));
}
开发者ID:vividos,项目名称:MultiplayerOnlineGame,代码行数:8,代码来源:Color.hpp


示例8: Interpolate

inline RGBA Interpolate(const RGBA& start, const RGBA& end, float fractionComplete) {
	RGBA interpRGBA;
	interpRGBA.r() = Interpolate(start.r(), end.r(), fractionComplete);
	interpRGBA.g() = Interpolate(start.g(), end.g(), fractionComplete);
	interpRGBA.b() = Interpolate(start.b(), end.b(), fractionComplete);
	interpRGBA.a() = Interpolate(start.a(), end.a(), fractionComplete);
	return interpRGBA;
}
开发者ID:2bitdreamer,项目名称:SD6_Engine,代码行数:8,代码来源:EngineCommon.hpp


示例9: Interpolate

	Vector3 Interpolate(const Vector3 &v1, const Vector3 &v2, float f)
	{
		Vector3 _v = v1 ;
		_v.x = Interpolate(_v.x, v2.x, f) ;
		_v.y = Interpolate(_v.y, v2.y, f) ;
		_v.z = Interpolate(_v.z, v2.z, f) ;
		return _v ;
	}
开发者ID:NuponsaltDev,项目名称:Game001,代码行数:8,代码来源:Math.cpp


示例10: Interpolate

void FFMODListener::UpdateCurrentInteriorSettings()
{
	// Store the interpolation value, not the actual value
	InteriorVolumeInterp = Interpolate( InteriorEndTime );
	ExteriorVolumeInterp = Interpolate( ExteriorEndTime );
	InteriorLPFInterp = Interpolate( InteriorLPFEndTime );
	ExteriorLPFInterp = Interpolate( ExteriorLPFEndTime );
}
开发者ID:bibahtulo,项目名称:ue4integration,代码行数:8,代码来源:FMODListener.cpp


示例11: InterpolateRGBa

global func InterpolateRGBa(RGBa_1,RGBa_2,x1,x2,x3)
{
  var r = Interpolate(GetRGBaValue(RGBa_1,1),GetRGBaValue (RGBa_2,1),x1,x2,x3);
  var g = Interpolate(GetRGBaValue(RGBa_1,2),GetRGBaValue (RGBa_2,2),x1,x2,x3);
  var b = Interpolate(GetRGBaValue(RGBa_1,3),GetRGBaValue (RGBa_2,3),x1,x2,x3);
  var a = Interpolate(GetRGBaValue(RGBa_1,0),GetRGBaValue (RGBa_2,0),x1,x2,x3);

  return(RGBa(r,g,b,a));
}
开发者ID:Fulgen301,项目名称:SGGP,代码行数:9,代码来源:Helper-Math.c


示例12: main

int main(void) {
    int i = 24332;
    float x = 432.321;
    std::string str1("foo");
    //Works
    std::cout << Interpolate(R"(goo % goo % goo)", i, x) << std::endl;
    // Does not work, even though I'm not actually doing anything with the string argument
    std::cout << Interpolate(R"(goo %)", str1) << std::endl;
}
开发者ID:CCJY,项目名称:coliru,代码行数:9,代码来源:main.cpp


示例13: Interpolate

//----------------------------------------------------------------//
float USInterpolate::Interpolate ( u32 mode, float x0, float x1, float t, float w ) {

	float v0 = Interpolate ( mode, x0, x1, t );
	
	if ( w == 1.0f ) {
		return v0;
	}
	float v1 = Interpolate ( kLinear, x0, x1, t );
	return Interpolate ( kLinear, v1, v0, w );
}
开发者ID:Odie,项目名称:moai-beta,代码行数:11,代码来源:USInterpolate.cpp


示例14: InterpolatePoint

void PressureTable::LookupSelectedCoeff(double &RoM,  double &T0,    double &E0,
                                        double &Gam0, double &a_Gam, double P,
                                        double Zm,    double Zvar,   double C) {
  InterpolatePoint(P, Zm, Zvar, C);
  RoM      = Interpolate(0);
  T0       = Interpolate(1);
  E0       = Interpolate(2);
  Gam0     = Interpolate(3);
  a_Gam    = Interpolate(4);
}
开发者ID:ale11,项目名称:JoeX,代码行数:10,代码来源:PressureTable.cpp


示例15: FindNoise

double Noise::Generate(double x, double y)
{
	double s, t, u, v;
	s = FindNoise(floor(x), floor(y));
	t = FindNoise(ceil(x), floor(y));
	u = FindNoise(floor(x), ceil(y));//Get the surrounding pixels to calculate the transition.
	v = FindNoise(ceil(x), ceil(y));
	double y1 = Interpolate(s, t, x - floorf(x));//Interpolate between the values.
	double y2 = Interpolate(u, v, x - floorf(x));//Here we use x-floorx, to get 1st dimension. Don't mind the x-floorx thingie, it's part of the cosine formula.
	return Interpolate(y1, y2, y - floorf(y));//Here we use y-floory, to get the 2nd dimension.
}
开发者ID:zsebastian,项目名称:AI-Homework,代码行数:11,代码来源:Random.cpp


示例16: switch

void Voice::RenderAudio() {

    switch (this->PlaybackState) {

        case playback_state_ram: {
                Interpolate((sample_t*) pSample->GetCache().pStart);
                if (DiskVoice) {
                    // check if we reached the allowed limit of the sample RAM cache
                    if (Pos > MaxRAMPos) {
                        dmsg(("Voice: switching to disk playback (Pos=%f)\n", Pos));
                        this->PlaybackState = playback_state_disk;
                    }
                }
                else if (Pos >= pSample->GetCache().Size / pSample->FrameSize) {
                    this->PlaybackState = playback_state_end;
                }
            }
            break;

        case playback_state_disk: {
                if (!DiskStreamRef.pStream) {
                    // check if the disk thread created our ordered disk stream in the meantime
                    DiskStreamRef.pStream = pDiskThread->AskForCreatedStream(DiskStreamRef.OrderID);
                    if (!DiskStreamRef.pStream) {
                        std::cout << stderr << "Disk stream not available in time!" << std::endl << std::flush;
                        pDiskThread->OrderDeletionOfStream(&DiskStreamRef);
                        this->Active = false;
                        return;
                    }
                    DiskStreamRef.pStream->IncrementReadPos(pSample->Channels * (double_to_int(Pos) - MaxRAMPos));
                    Pos -= double_to_int(Pos);
                }

                // add silence sample at the end if we reached the end of the stream (for the interpolator)
                if (DiskStreamRef.State == Stream::state_end && DiskStreamRef.pStream->GetReadSpace() < (OutputBufferSize << MAX_PITCH) / pSample->Channels) {
                    DiskStreamRef.pStream->WriteSilence((OutputBufferSize << MAX_PITCH) / pSample->Channels);
                    this->PlaybackState = playback_state_end;
                }

                sample_t* ptr = DiskStreamRef.pStream->GetReadPtr(); // get the current read_ptr within the ringbuffer where we read the samples from
                Interpolate(ptr);
                DiskStreamRef.pStream->IncrementReadPos(double_to_int(Pos) * pSample->Channels);
                Pos -= double_to_int(Pos);
            }
            break;

        case playback_state_end:
            this->Active = false; // free voice
            break;
    }
}
开发者ID:svn2github,项目名称:linuxsampler,代码行数:51,代码来源:voice.cpp


示例17: GetVector

  GeoVector 
  GetVector(fixed time) const
  {
    assert(Ready());

    if (!positive(p[2].t-p[1].t)) {
      return GeoVector(fixed_zero, Angle::zero());
    }

    const Record r0 = Interpolate(time - fixed(0.05));
    const Record r1 = Interpolate(time + fixed(0.05));
    return GeoVector(p[1].loc.distance(p[2].loc)/
                     (p[2].t-p[1].t), r0.loc.bearing(r1.loc));
  }
开发者ID:macsux,项目名称:XCSoar,代码行数:14,代码来源:CatmullRomInterpolator.hpp


示例18: GetFrame

void Bone::ScaleForFrame(int32 f, double* x, double* y) const {
    const Frame* frame = NULL, * prevFrame = NULL, * nextFrame = NULL;
	GetFrame(f, &frame, &prevFrame, &nextFrame);

	if ( frame != NULL ) {
		*x = frame->GetScaleX();
		*y = frame->GetScaleY();
	} else if ( prevFrame != NULL  &&  nextFrame != NULL ) {
		*x = Interpolate(f, prevFrame->GetId(), nextFrame->GetId(), prevFrame->GetScaleX(), nextFrame->GetScaleX());
		*y = Interpolate(f, prevFrame->GetId(), nextFrame->GetId(), prevFrame->GetScaleY(), nextFrame->GetScaleY());
	} else {
		*x = *y = 0;
	}
}
开发者ID:jjimenezg93,项目名称:InputManager,代码行数:14,代码来源:bone.cpp


示例19: Interpolate

const Rgba Interpolate(const Rgba& start, const Rgba& end, float fractionFromStartToEnd) {

	float lerpedR = Interpolate(start.fR(), end.fR(), fractionFromStartToEnd);
	float lerpedG = Interpolate(start.fG(), end.fG(), fractionFromStartToEnd);
	float lerpedB = Interpolate(start.fB(), end.fB(), fractionFromStartToEnd);
	float lerpedA = Interpolate(start.fA(), end.fA(), fractionFromStartToEnd);

	unsigned char lerpedCR = Rgba::cR(lerpedR);
	unsigned char lerpedCG = Rgba::cG(lerpedG);
	unsigned char lerpedCB = Rgba::cB(lerpedB);
	unsigned char lerpedCA = Rgba::cA(lerpedA);

	return Rgba(lerpedCR, lerpedCG, lerpedCB, lerpedCA);
}
开发者ID:achen889,项目名称:Warlockery_Engine,代码行数:14,代码来源:Rgba.cpp


示例20: dc

CFrameAnimation::CFrameAnimation(CWnd* pWnd,
	int iStartX1,int iStartY1,int iStartX2,int iStartY2,
	int iEndX1,int iEndY1,int iEndX2,int iEndY2)
{
	CClientDC dc(pWnd);

	for(int i=0;i<=NUMFRAMES+1;i++)
	{
		// Remove last frame
		if(i!=0)
			InvertHollowRect(dc,
				Interpolate(iStartX1,iEndX1,i-1),
				Interpolate(iStartY1,iEndY1,i-1),
				Interpolate(iStartX2,iEndX2,i-1),
				Interpolate(iStartY2,iEndY2,i-1));

		// If we've just undrawn final frame, break out
		if(i==NUMFRAMES+1) break;

		// Draw this frame
		InvertHollowRect(dc,
			Interpolate(iStartX1,iEndX1,i),
			Interpolate(iStartY1,iEndY1,i),
			Interpolate(iStartX2,iEndX2,i),
			Interpolate(iStartY2,iEndY2,i));

		// Pause some so that user gets to see it
		Sleep(150/NUMFRAMES);
	}
}
开发者ID:quen,项目名称:leafdrums2,代码行数:30,代码来源:FrameAnimation.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Interrupt函数代码示例发布时间:2022-05-30
下一篇:
C++ InternetSetOption函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap