Beispiel #1
0
//-----------------------------------------------------------------------------
// Purpose: Think function. Accelerates a func_rotating to a higher angular velocity.
//-----------------------------------------------------------------------------
void CFuncRotating::SpinUpMove( void )
{
	//
	// Calculate our new speed.
	//
	bool bSpinUpDone = false;
	float flNewSpeed = fabs( m_flSpeed ) + 0.2 * m_flMaxSpeed * m_flFanFriction;
	if ( fabs( flNewSpeed ) >=  fabs( m_flTargetSpeed ) )
	{
		// Reached our target speed.
		flNewSpeed = m_flTargetSpeed;
		bSpinUpDone = !m_bStopAtStartPos;
	}
	else if ( m_flTargetSpeed < 0 )
	{
		// Spinning up in reverse - negate the speed.
		flNewSpeed *= -1;
	}

	//
	// Apply the new speed, adjust sound pitch and volume.
	//
	UpdateSpeed( flNewSpeed );

	//
	// If we've met or exceeded target speed, stop spinning up.
	//
	if ( bSpinUpDone )
	{
		SetMoveDone( &CFuncRotating::RotateMove );
		RotateMove();
	} 

	SetMoveDoneTime( GetNextMoveInterval() );
}
Beispiel #2
0
//-----------------------------------------------------------------------------
// Purpose: Think function. Decelerates a func_rotating to a lower angular velocity.
//-----------------------------------------------------------------------------
void CFuncRotating::SpinDownMove( void )
{
	//
	// If we've met or exceeded target speed, stop spinning down.
	//
	if ( SpinDown( m_flTargetSpeed ) )
	{
		SetMoveDone( &CFuncRotating::RotateMove );
		RotateMove();
	}
	else
	{
		SetMoveDoneTime( GetNextMoveInterval() );
	}
}
Beispiel #3
0
void CcdrawDoc::RotateMove(CComplex c, double t, int EditAction)
{
	int i;
	CComplex x,z;

	z=exp(I*t*PI/180);

	if(EditAction==0)
	{
		for(i=0;i<nodelist.GetSize();i++)
		{
			if(nodelist[i].IsSelected==TRUE){
				x.Set(nodelist[i].x,nodelist[i].y);
				x=(x-c)*z+c;
				nodelist[i].x=x.re;
				nodelist[i].y=x.im;
			}
		}
		EnforcePSLG();
		return;
	}

	if(EditAction==1)
	{
		for(i=0;i<linelist.GetSize();i++)
		{
			if(linelist[i].IsSelected==TRUE){
				nodelist[linelist[i].n0].IsSelected=TRUE;
				nodelist[linelist[i].n1].IsSelected=TRUE;
			}
		}
		RotateMove(c,t,0);
		return;
	}

	if(EditAction==2)
	{
		for(i=0;i<blocklist.GetSize();i++)
		{
			if(blocklist[i].IsSelected==TRUE){
				x.Set(blocklist[i].x,blocklist[i].y);
				x=(x-c)*z+c;
				blocklist[i].x=x.re;
				blocklist[i].y=x.im;
			}
		}
		EnforcePSLG();
		return;
	}

	if(EditAction==3)
	{
		for(i=0;i<arclist.GetSize();i++)
		{
			if(arclist[i].IsSelected==TRUE){
				nodelist[arclist[i].n0].IsSelected=TRUE;
				nodelist[arclist[i].n1].IsSelected=TRUE;
			}
		}
		RotateMove(c,t,0);
		return;
	}

	if(EditAction==4)
	{

		for(i=0;i<linelist.GetSize();i++)
		{
			if(linelist[i].IsSelected==TRUE){
				nodelist[linelist[i].n0].IsSelected=TRUE;
				nodelist[linelist[i].n1].IsSelected=TRUE;
			}
		}

		for(i=0;i<arclist.GetSize();i++)
		{
			if(arclist[i].IsSelected==TRUE){
				nodelist[arclist[i].n0].IsSelected=TRUE;
				nodelist[arclist[i].n1].IsSelected=TRUE;
			}
		}

		for(i=0;i<nodelist.GetSize();i++)
		{
			if(nodelist[i].IsSelected==TRUE){
				x.Set(nodelist[i].x,nodelist[i].y);
				x=(x-c)*z+c;
				nodelist[i].x=x.re;
				nodelist[i].y=x.im;
			}
		}
	
		for(i=0;i<blocklist.GetSize();i++)
		{
			if(blocklist[i].IsSelected==TRUE){
				x.Set(blocklist[i].x,blocklist[i].y);
				x=(x-c)*z+c;
				blocklist[i].x=x.re;
				blocklist[i].y=x.im;
			}
		}

		EnforcePSLG();
		return;
	}
}