Esempio n. 1
0
void ofQuaternion::getRotate( float& angle, ofVec3f& vec ) const {
	float x, y, z;
	getRotate(angle, x, y, z);
	vec.x = x;
	vec.y = y;
	vec.z = z;
}
Esempio n. 2
0
void CSphere::update(float delta)
{
	// 카메라 좌표계 기준으로 이동시켜야 하므로 좌표계를 변환
	auto camera = CGameManager::GetInstance()->GetRenderer()->GetCamera();
	auto cameraAngle = XMConvertToRadians((*camera->getRotate()).m128_f32[1]);
	translation( XMVector3Transform(mSpeed, XMMatrixRotationY(cameraAngle)) );
	
	// 네 모서리와 부딪혔는지 체크
	auto width = camera->getWidth();
	auto height = camera->getHeight();
	auto pos = ConvertCenterToViewingCoord();

	// 위쪽 벽에 공이 닿음
	if (pos.m128_f32[1] + mScale.m128_f32[0] >= (height / 2))
		mulSpeed({ 1.f, -1.f, 1.f });

	// 아래쪽 벽에 공이 닿음 - 게임 오버
	if (pos.m128_f32[1] - mScale.m128_f32[0] <= -(height / 2))
		CGameManager::GetInstance()->GetEventManager()->triggerEvent("Gameover");

	// 왼쪽 벽에 공이 닿음
	if (pos.m128_f32[0] - mScale.m128_f32[0] < -(width / 2))
		CGameManager::GetInstance()->GetEventManager()->triggerEvent("RotateLeft");

	// 오른쪽 벽에 공이 닿음
	if (pos.m128_f32[0] + mScale.m128_f32[0] > (width / 2))
		CGameManager::GetInstance()->GetEventManager()->triggerEvent("RotateRight");

	CPrimitive::update(delta);
}
void ofxQuaternion::getRotate( float& angle, ofxVec3f& vec ) const {
    float x, y, z;
    getRotate(angle, x, y, z);
    vec[0] = x;
    vec[1] = y;
    vec[2] = z;
}
Esempio n. 4
0
void Jets::update(Uint32 ticks) { 

  int deviation = getRandomFactorBetween(0,200);
  int length = sqrt((playerX+deviation - X())*(playerX+deviation-X()) + (playerY+deviation-Y())*(playerY+deviation-Y()));
  velocityX(throttleX*(playerX - X())/length);
  velocityY(throttleY*(playerY - Y())/length);
   int delta_x = playerX - X();
   int delta_y = playerY - Y();
   angle = -(atan2(delta_y, delta_x)*180.0000)/3.142 ;
  
   Vector2f incr = getVelocity() *  static_cast<float>(ticks) * 0.001;
   setPosition(getPosition() + incr);

  if(getRotate()) 
   angle += getRotationSpeed() % 360;
  if ( Y() < 0) {
    velocityY( abs( velocityY() ) );
  }
  if ( Y() > worldHeight-frameHeight) {
    velocityY( -abs( velocityY() ) );
  }

  if ( X() < 0) {
    velocityX( abs( velocityX() ) );
  }
  if ( X() > worldWidth-frameWidth) {
    velocityX( -abs( velocityX() ) );
  }  
}
Esempio n. 5
0
ossim::Quaternion ossimMatrix4x4::getRotate()const
{
   ossim::Quaternion quat;

   getRotate(quat);
   
   return quat;
}
Esempio n. 6
0
    VOID Quaternion::getRotate( F32 & angle, Vector3& vec ) const
	{
		F32 x,y,z;
		getRotate(angle,x,y,z);
		vec[0]=x;
		vec[1]=y;
		vec[2]=z;
	}
Esempio n. 7
0
void Quat::getRotate( value_type& angle, Vec3d& vec ) const
{
    value_type x,y,z;
    getRotate(angle,x,y,z);
    vec[0]=x;
    vec[1]=y;
    vec[2]=z;
}
Esempio n. 8
0
void Quat::getRotate( value_type& angle, Vec3f& vec ) const
{
    value_type x,y,z;
    getRotate(angle,x,y,z);
    vec[0]= Vec3f::value_type(x);
    vec[1]= Vec3f::value_type(y);
    vec[2]= Vec3f::value_type(z);
}
Esempio n. 9
0
void t3Quaternion::getRotate(float& angle, t3Vector3f& vec) const
{
    float x, y, z;
    getRotate(angle, x, y, z);
    vec.x = x;
    vec.y = y;
    vec.z = z;
}
/**
 * Fija la cantidad de rotacion que se les aplica a las particulas si la opcion de rotacion de las particulas esta activada
 * @param rotation
 */
void SpriteParticleSystem::setParticleRotation(float rotation)
{
    if(getRotate())
    {
        m_particleRotate = rotation;
    }
    else m_particleRotate = 0;
}
Esempio n. 11
0
void
SVGTransformable::drotate(double dangle=0)
{
	SVGRotateTransform * rotate = getRotate(true);
	rotate->angle += dangle;
	rotate->cx = 0;
	rotate->cy = 0;
	rotate->updateMatrix();
	SVGElement* meAsSVGElement = dynamic_cast<SVGElement*>(this);
	if(meAsSVGElement) meAsSVGElement->setDamaged(true);
}
//----------
void LeapToCameraCalibrator::setExtrinsics(cv::Mat rotation, cv::Mat translation)
{
	const auto rotationMatrix = ofxCvMin::makeMatrix(rotation, cv::Mat::zeros(3, 1, CV_64F));
	const auto rotationEuler = rotationMatrix.getRotate().getEuler();
    
	translationX = translation.at<double>(0);
	translationY = translation.at<double>(1);
	translationZ = translation.at<double>(2);
    
	rotationX = rotationEuler.x;
	rotationY = rotationEuler.y;
	rotationZ = rotationEuler.z;
    
	projector.setView(ofxCvMin::makeMatrix(rotation, translation));
}
Action::ResultE
SkeletonOgreJoint::jointUpdateEnter(JointTraverser *jt)
{
    Action::ResultE  res  = Action::Continue;
    Skeleton        *skel = getSkeleton();

#ifdef OSG_DEBUG
    if(_sfJointId.getValue() == INVALID_JOINT_ID)
    {
        SWARNING << "SkeletonOgreJoint::jointUpdateEnter: "
                 << "Joint has invalid jointId. Ignoring." << std::endl;
        return res;
    }
    
    if(skel == NULL)
    {
        SWARNING << "SkeletonOgreJoint::jointUpdateEnter: "
                 << "Joint has no skeleton. Ignoring." << std::endl;
        return res;
    }
#endif

    Int16                          jointId     = getJointId();
    Skeleton::MFJointMatricesType *jointMats   =
        skel->editMFJointMatrices();
    SkeletonOgreJoint             *parentJoint =
        dynamic_cast<SkeletonOgreJoint *>(skel->getParentJoints(jointId));

    if(parentJoint != NULL)
    {
        _accumRotate = parentJoint->_accumRotate;
        _accumRotate.mult(getRotate      ());
        _accumRotate.mult(getOffsetRotate());

        _accumScale = parentJoint->_accumScale;
        _accumScale[0] *= getScale()[0] * getOffsetScale()[0];
        _accumScale[1] *= getScale()[1] * getOffsetScale()[1];
        _accumScale[2] *= getScale()[2] * getOffsetScale()[2];

        _accumTranslate = getTranslate() + getOffsetTranslate();
        _accumTranslate[0] *= parentJoint->_accumScale[0];
        _accumTranslate[1] *= parentJoint->_accumScale[1];
        _accumTranslate[2] *= parentJoint->_accumScale[2];

        parentJoint->_accumRotate.multVec(_accumTranslate, _accumTranslate);
        _accumTranslate += parentJoint->_accumTranslate;   
    }
    else
    {
        _accumRotate    = getRotate();
        _accumRotate.mult(getOffsetRotate());

        _accumScale     = getScale();
        _accumScale[0] *= getOffsetScale()[0];
        _accumScale[1] *= getOffsetScale()[1];
        _accumScale[2] *= getOffsetScale()[2];

        _accumTranslate = getTranslate() + getOffsetTranslate();
    }

    Quaternion jointRotate   (_accumRotate   );
    Vec3f      jointTranslate(_accumTranslate);
    Vec3f      jointScale    (_accumScale    );

    if(skel->getUseInvBindMatrix() == true)
    {
        jointRotate.mult(getInvBindRotate());
        jointScale[0]  *= getInvBindScale()[0];
        jointScale[1]  *= getInvBindScale()[1];
        jointScale[2]  *= getInvBindScale()[2];

        jointTranslate[0] = jointScale[0] * getInvBindTranslate()[0];
        jointTranslate[1] = jointScale[1] * getInvBindTranslate()[1];
        jointTranslate[2] = jointScale[2] * getInvBindTranslate()[2];

        jointRotate.multVec(jointTranslate, jointTranslate);

        jointTranslate += _accumTranslate;
    }

    Matrix matJoint;
    matJoint.setTransform(jointTranslate, jointRotate, jointScale);

    (*jointMats)[jointId] = matJoint;

    return res;
}
Esempio n. 14
0
void BtnCtrl::printCoordinate()
{
	char  str[80];
	sprintf(str, "X: %f Y: %f Y: %f rot: %f \n", getX(), getY(), getZ(), getRotate());
	OutputDebugString(str);
}