Example #1
0
void wxGISMapView::RotateStop(wxPoint MouseLocation)
{
    ReleaseMouse();
	//compute angle
	double dX = m_FrameCenter.x - MouseLocation.x;
	double dY = m_FrameCenter.y - MouseLocation.y;
	double dAngle = atan2(dY, dX);
	dAngle -= m_dOriginAngle;
	double dPrevRotate = m_pGISDisplay->GetRotate();
	double dfRotate = dPrevRotate + dAngle;

	//m_dCurrentAngle = DOUBLEPI - m_pGISDisplay->GetRotate() - dAngle;
	//if(m_dCurrentAngle > DOUBLEPI)
	//	m_dCurrentAngle -= DOUBLEPI;
	//if(m_dCurrentAngle < 0)
	//	m_dCurrentAngle += DOUBLEPI;

	if(dfRotate >= DOUBLEPI)
		dfRotate -= DOUBLEPI;
	if(dfRotate < 0)
		dfRotate += DOUBLEPI;
	m_nDrawingState = enumGISMapDrawing;

	SetRotate(dfRotate);//(dPrevRotate + dAngle);
}
Example #2
0
void CNrpMiniMap::draw()
{
	if( animNode_ )
		SetRotate( core::vector3df( 0, 0, animNode_->getRotation().X ) );

	CNrpRotatableImage::draw();
}
bool SVGMotionSMILAnimationFunction::SetAttr(nsAtom* aAttribute,
                                             const nsAString& aValue,
                                             nsAttrValue& aResult,
                                             nsresult* aParseResult) {
  // Handle motion-specific attrs
  if (aAttribute == nsGkAtoms::keyPoints) {
    nsresult rv = SetKeyPoints(aValue, aResult);
    if (aParseResult) {
      *aParseResult = rv;
    }
  } else if (aAttribute == nsGkAtoms::rotate) {
    nsresult rv = SetRotate(aValue, aResult);
    if (aParseResult) {
      *aParseResult = rv;
    }
  } else if (aAttribute == nsGkAtoms::path || aAttribute == nsGkAtoms::by ||
             aAttribute == nsGkAtoms::from || aAttribute == nsGkAtoms::to ||
             aAttribute == nsGkAtoms::values) {
    aResult.SetTo(aValue);
    MarkStaleIfAttributeAffectsPath(aAttribute);
    if (aParseResult) {
      *aParseResult = NS_OK;
    }
  } else {
    // Defer to superclass method
    return SMILAnimationFunction::SetAttr(aAttribute, aValue, aResult,
                                          aParseResult);
  }

  return true;
}
Example #4
0
hsMatrix44&     hsMatrix44::MakeRotateMat(int axis, float radians)
{
    Reset();
    SetRotate(axis, radians);
    NotIdentity();
    return *this;
}
Example #5
0
bool CMotionControl::Test3D(const mm1000_t src[NUM_AXIS],const mm1000_t ofs[NUM_AXIS],mm1000_t dest[NUM_AXIS], mm1000_t vect[NUM_AXIS], float angle, bool printOK)
{
	SetRotate(angle,vect,ofs);
	return Test(src,ofs,dest, printOK, [=] (void) -> void { 
		DumpArray<mm1000_t, NUM_AXIS>(F("Vector"), vect, false);
		DumpType<float>(F("Angle"), angle, false);
	}	);
}
Example #6
0
inline void MotorPort0ConfigInterface1(MotorPort * me) {
	Tim8Config1();
	PC0nPC1DirectionConfig1();
	me->motorTIM = &(TIM8->CCR1);
	me->motorControlPort[0] = GPIOC;
	me->motorControlPin[0] = GPIO_Pin_0;
	me->motorControlPort[1] = GPIOC;
	me->motorControlPin[1] = GPIO_Pin_1;
	SetRotate(me, 0);
}
Example #7
0
void MotorPortConfigForMAT(MotorPort * me) {
	Pin4DAC1Config2();
	PC0nPC1DirectionConfig1();
	me->motorDAC = (uint32_t*) (DAC_BASE + DHR12R1_OFFSET + DAC_Align_12b_R);
	me->motorTIM = 0;
	me->motorControlPort[0] = GPIOC;
	me->motorControlPin[0] = GPIO_Pin_0;
	me->motorControlPort[1] = GPIOC;
	me->motorControlPin[1] = GPIO_Pin_1;
	SetRotate(me, 0);
}
Example #8
0
inline void MotorPort0ConfigInterface2(MotorPort * me) {
	Pin4DAC1Config2();
	PE6nPC13DirectionConfig2();
	me->motorDAC = (uint32_t*) (DAC_BASE + DHR12R1_OFFSET + DAC_Align_12b_R);
	me->motorTIM = 0;
	me->motorControlPort[0] = GPIOE;
	me->motorControlPin[0] = GPIO_Pin_6;
	me->motorControlPort[1] = GPIOC;
	me->motorControlPin[1] = GPIO_Pin_13;
	SetRotate(me, 0);
}
Example #9
0
//for implementation
inline void MotorPort0ConfigInterface0(MotorPort * me) {
	Pin5DAC2Config0();
	PB0nPB1DirectionConfig0();
	me->motorDAC = (uint32_t*) (DAC_BASE + DHR12R2_OFFSET + DAC_Align_12b_R);
	me->motorTIM = 0;
	me->motorControlPort[0] = GPIOB;
	me->motorControlPin[0] = GPIO_Pin_0;
	me->motorControlPort[1] = GPIOB;
	me->motorControlPin[1] = GPIO_Pin_1;
	SetRotate(me, 0);
}
Example #10
0
drape_ptr<MapLinearAnimation> GetRectAnimation(ScreenBase const & startScreen, ScreenBase const & endScreen)
{
  auto anim = make_unique_dp<MapLinearAnimation>();

  anim->SetRotate(startScreen.GetAngle(), endScreen.GetAngle());
  anim->SetMove(startScreen.GetOrg(), endScreen.GetOrg(),
                startScreen.PixelRectIn3d(), (startScreen.GetScale() + endScreen.GetScale()) / 2.0);
  anim->SetScale(startScreen.GetScale(), endScreen.GetScale());
  anim->SetMaxScaleDuration(kMaxAnimationTimeSec);

  return anim;
}
void CRotateDispWnd::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	KillTimer(1);
	ShowWindow(SW_MINIMIZE);
	ShowWindow(SW_HIDE);
	if(IsMouseDllOk)
	{
		SetRotate(FALSE);

		switch(RotNum)
		{
			case ANG_90:
				SetRotateAngle(90);
				break;

			case ANG_180:
				SetRotateAngle(180);
				break;

			case ANG_270:
				SetRotateAngle(270);
				break;
			
			default:
				goto path1;
		}
		SetRotate(TRUE);
	}
path1:
	ChangeDispById(RotNum&3);
	if(PathFileExists("RotateDisp.vbs"))
	{
		char param=(RotNum&3)+'0';
		ShellExecute(NULL,"open","RotateDisp.vbs",&param,NULL,SW_SHOWNORMAL);
	}
	CWnd::OnTimer(nIDEvent);
}
Example #12
0
drape_ptr<MapLinearAnimation> GetSetRectAnimation(ScreenBase const & screen,
                                                  m2::AnyRectD const & startRect, m2::AnyRectD const & endRect)
{
  auto anim = make_unique_dp<MapLinearAnimation>();

  double const startScale = CalculateScale(screen.PixelRect(), startRect.GetLocalRect());
  double const endScale = CalculateScale(screen.PixelRect(), endRect.GetLocalRect());

  anim->SetRotate(startRect.Angle().val(), endRect.Angle().val());
  anim->SetMove(startRect.GlobalCenter(), endRect.GlobalCenter(), screen);
  anim->SetScale(startScale, endScale);
  anim->SetMaxScaleDuration(kMaxAnimationTimeSec);

  return anim;
}
int mapcontrol::OPMapWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QGraphicsView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 22)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 22;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = MinZoom(); break;
        case 1: *reinterpret_cast< bool*>(_v) = ShowTileGridLines(); break;
        case 2: *reinterpret_cast< double*>(_v) = ZoomTotal(); break;
        case 3: *reinterpret_cast< qreal*>(_v) = Rotate(); break;
        }
        _id -= 4;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: SetMinZoom(*reinterpret_cast< int*>(_v)); break;
        case 1: SetShowTileGridLines(*reinterpret_cast< bool*>(_v)); break;
        case 2: SetZoom(*reinterpret_cast< double*>(_v)); break;
        case 3: SetRotate(*reinterpret_cast< qreal*>(_v)); break;
        }
        _id -= 4;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 4;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #14
0
int KItemImage::SetImageType(int nType)
{
	if (nType < ITEMIMAGE_NORMAL || nType >= ITEMIMAGE_END)
		return false;

	if (nType == m_nImageType)
		return true;

	if (m_nImageType == ITEMIMAGE_ROTATE)
		SetPercentage(1.0f);

	m_nImageType = nType;
	if (m_nImageType == ITEMIMAGE_ROTATE)
		SetRotate(0.0f);

	m_dwStyle &= ~ITEM_DATA_FORMATED;

	return true;
}
Example #15
0
void Terrain::SetRotate(float x, float y, float z)
{
	SetRotate(Vector3f(x, y, z));
}
Example #16
0
inline void SetSoftStopInterface1(MotorPort * me) {
	SetRotate(me, 0);
}
Example #17
0
inline void SetSoftStopInterface0(MotorPort * me) {
	GPIO_WriteBit(GPIOA, GPIO_Pin_6, !SET);
	GPIO_WriteBit(GPIOA, GPIO_Pin_7, !SET);
	SetRotate(me, 0);
}
Example #18
0
//Improved Initialization with struct implementation
void AnimationObj::Init(AnimationObjStruct *AniStruct){	
	//----------------------------------------
	theReader->AnimationObjFrameInfo(Index, width, height, maxFrame, animationColumns, 
		maxAnimationOrientation, collidable, boundX, boundY, usingTexture, textureID, entranceEffectID, stationary, animationTypeID);
	
	//initialize entrance effect parameters
	if(entranceEffectID != NoEffect)
		useEntranceEffextSprite = true;

	switch(entranceEffectID){
	case Diagonal:
			useEntranceEffextSprite = theReader->GetUseDiagonalSprite(Index, maxEntranceEffextSpriteFrame, animationTypeID);
			if(!useEntranceEffextSprite)
				entranceEffectID = NoEffect;
		break;
	default:
		break;
	}
	
	InitConst();
	//timeStep = TimeStep; //time increwment, used in update()

	usingOrientation = true;
	stationary = false;
	//----------------------------------

	//position coordinate
	x =  AniStruct->X;
	y =  AniStruct->Y;

	x1 =  AniStruct->X1;
	y1 =  AniStruct->Y1;
	x2 =  AniStruct->X2;
	y2 =  AniStruct->Y2;

	//error checking at initialization 
	if(x == 0 && y==0){
		x = (x1 + x2)/2.0;
		y = (y1 + y2)/2.0;
	}
	
	//velocity
	xVel = AniStruct->XVel;
	yVel = AniStruct->YVel;
	SetRotate(AniStruct->Rotation);
	
	boundX = AniStruct->BoundX;
	boundY =  AniStruct->BoundY;

	startTimeInMS =  AniStruct->StartingTimeInMS;
	animationOrientation =  AniStruct->AnimationOrientation;
	frameDelay = AniStruct->FrameDelay;

	////Normalize speed
	//xVel = xVel * TimeStepInSecond;
	//yVel = yVel * TimeStepInSecond;

	if(AniStruct->Radius > 0){
		SetCollisionRadius(AniStruct->Radius);
	}

	//call to set the scale and rotation
	ComputeCoordinate();
}
Example #19
0
void Object3D::SetRotate(float x, float y, float z)
{
	SetRotate(Vector3f(x, y, z));
}
Example #20
0
GfMatrix3d::GfMatrix3d(const GfRotation &rot)
{
    SetRotate(rot);
}
Example #21
0
void CMotionControl::UnitTest()
{
#ifdef DO_UNITTEST

	InitConversion(ToMm1000_1_1000, ToMachine_1_1000);

	// matrix test

	float msrc[NUM_AXISXYZ][NUM_AXISXYZ] = { { 3 , 2 , 3 }, { 4, 5, 6}, { 7, 8, 9,} } ;
	float mdest[3][3];
	float mdest2[3][3];

	CMatrix3x3<float>::Invert(msrc,mdest);
	CMatrix3x3<float>::Invert(mdest,mdest2);

	float v1[3] = { 1.0, 2.0, 3.0 };
	float v2[3];

	CMatrix3x3<float>::Mul(mdest2,v1,v2);

	// see: http://www.math.kit.edu/iag2/~globke/media/koordinaten.pdf
	// see: http://de.wikipedia.org/wiki/Denavit-Hartenberg-Transformation

	float theta = (float)(15.0 * 180 / M_PI);	// phi ... einer Rotation \theta_n(Gelenkwinkel) um die z_{ n - 1 }-Achse, damit die x_{ n - 1 }-Achse parallel zu der x_n - Achse liegt
	float alpha = (float)(10.0 * 180 / M_PI);	// alpha ... einer Rotation \alpha_n (Verwindung) um die x_n-Achse, um die z_{n - 1}-Achse in die z_n-Achse zu überführen
	float di = 10;								// d ... einer Translation d_n (Gelenkabstand) entlang der z_{n - 1}- Achse bis zu dem Punkt, wo sich z_{n - 1} und x_n schneiden
	float ai = 5;								// a ... einer Translation a_n (Armelementlänge) entlang der x_n-Achse, um die Ursprünge der Koordinatensysteme in Deckung zu bringen

	float A1[4][4] = 
	{ 
		{ cos(theta),	-sin(theta)*cos(alpha),		sin(theta)*sin(alpha),		ai*cos(theta) },
		{ sin(theta),	cos(theta)*cos(alpha),		-cos(theta)*sin(alpha),		ai*sin(theta) },
		{ 0,			sin(alpha),					cos(alpha),					di },
		{ 0,			0,						0,						1	}
	};

	float A2[4][4];

	CMatrix4x4<float>::InitDenavitHartenberg(A2,alpha,theta,ai,di);


	float ps[4] = { 1, 2, 3, 1 };
	float pd[4];

	CMatrix4x4<float>::Mul(A1, ps, pd);

	// 3d Test

	mm1000_t ofs[3] = { 1000,2000,71000 };

	mm1000_t srcX[3] = { 1000,0,0 };
	mm1000_t srcY[3] = { 0,1000,0 };
	mm1000_t srcZ[3] = { 0,0,1000 };
	mm1000_t srcXY[3] = { 1000,2000,3000 };
	mm1000_t dest[3] = { 0,0,0 };

	mm1000_t vectX[3] = { 100,0,0 };
	mm1000_t vectY[3] = { 0,100,0 };
	mm1000_t vectZ[3] = { 0,0,100 };

	mm1000_t vectXY[3] = { 100,100,0 };
	mm1000_t vectXZ[3] = { 100,0,100 };
	mm1000_t vectYZ[3] = { 0,100,100 };

	mm1000_t vectXYZ[3] = { 100,100,100 };

	float angle=(float)(M_PI/6);
	//angle=0.001;

	Test3D(srcX,ofs,dest,vectX,angle,true);
	Test3D(srcX,ofs,dest,vectY,angle,true);
	Test3D(srcX,ofs,dest,vectZ,angle,true);

	Test3D(srcX,ofs,dest,vectXY,angle,true);
	Test3D(srcX,ofs,dest,vectXZ,angle,true);
	Test3D(srcX,ofs,dest,vectYZ,angle,true);

	Test3D(srcX,ofs,dest,vectXYZ,angle,true);

	Test3D(srcY,ofs,dest,vectX,angle,true);
	Test3D(srcY,ofs,dest,vectY,angle,true);
	Test3D(srcY,ofs,dest,vectZ,angle,true);
			
	Test3D(srcY,ofs,dest,vectXY,angle,true);
	Test3D(srcY,ofs,dest,vectXZ,angle,true);
	Test3D(srcY,ofs,dest,vectYZ,angle,true);
			
	Test3D(srcY,ofs,dest,vectXYZ,angle,true);

	Test3D(srcZ,ofs,dest,vectX,angle,true);
	Test3D(srcZ,ofs,dest,vectY,angle,true);
	Test3D(srcZ,ofs,dest,vectZ,angle,true);
			
	Test3D(srcZ,ofs,dest,vectXY,angle,true);
	Test3D(srcZ,ofs,dest,vectXZ,angle,true);
	Test3D(srcZ,ofs,dest,vectYZ,angle,true);
			
	Test3D(srcZ,ofs,dest,vectXYZ,angle,true);

	Test3D(srcXY,ofs,dest,vectX,angle,true);
	Test3D(srcXY,ofs,dest,vectY,angle,true);
	Test3D(srcXY,ofs,dest,vectZ,angle,true);
			
	Test3D(srcXY,ofs,dest,vectXY,angle,true);
	Test3D(srcXY,ofs,dest,vectXZ,angle,true);
	Test3D(srcXY,ofs,dest,vectYZ,angle,true);
			
	Test3D(srcXY,ofs,dest,vectXYZ,angle,true);

	ClearRotate();

	// 2D Test

	float angle2dX[3]={ angle,0,0 };
	float angle2dY[3]={ 0,angle, 0 };
	float angle2dZ[3]={ 0,0, angle };
	float angle2d[3]={ angle,angle, angle };

	Test2D(srcXY,ofs,dest,angle2dX,true);
	Test2D(srcXY,ofs,dest,angle2dY,true);
	Test2D(srcXY,ofs,dest,angle2dZ,true);

	Test2D(srcXY,ofs,dest,angle2d,true);

	//2d+3D

	SetRotate(angle,vectXYZ,ofs);
	Test2D(srcXY,ofs,dest,angle2d,true);

	ClearRotate2D();
	ClearRotate();

#endif
}
Example #22
0
void HK_Rotate270(int, bool justPressed) { SetRotate(MainWindow->getHWnd(), 270);}
Example #23
0
GfMatrix3f::GfMatrix3f(const GfQuatf &rot)
{
    SetRotate(rot);
}
Example #24
0
void DXCamera::SetRotate( float x, float y, float z )
{
	SetRotate( &D3DXVECTOR3( x, y, z ), 1 );
}