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


C++ Motion类代码示例

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


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

示例1: SwitchCameraMode

void SceneCamera::BrainOrder(const State& state)
{
    if (state.GetStateType() == (int)State::TYPE::PAUSE )
    {
        if (state.IsNew())
        {
            SwitchCameraMode(CONTROL_TYPE::CHARACTER);
        }
    }
    
    if (state.GetStateType() == (int)State::TYPE::MOTION )
    {
        if (state.IsNew())
        {
            SwitchCameraMode(CONTROL_TYPE::CHARACTER);
        }
        
        Motion* motion = (Motion*)&state;
        
        cameraControl.Move(motion->GetSpeed(), motion->GetDir());
    }
    
     if (state.GetStateType() == (int)State::TYPE::SPACE_LOC ) {
         
         SpaceLocation* space_loc = (SpaceLocation*)&state;
         
         if (state.IsNew())
         {
             SwitchCameraMode(CONTROL_TYPE::AUTO_CONTROL);
         }
  
            ((CameraAutoControl*)control[currentType])->SetPosition(space_loc->GetPos());
            ((CameraAutoControl*) control[currentType])->SetDirection(space_loc->GetDir());
     }
}
开发者ID:metatomato,项目名称:SceneGraph,代码行数:35,代码来源:SceneObject.cpp

示例2: main

int main()
{
  Motion motion;

  //motion.moveRight(1000);

  //usleep(5000000);

  motion.moveForward(1000);
  motion.moveForward(200);

  //usleep(5000000);

  //motion.spinACW(90);

  //usleep(5000000);

  //motion.spinCW(90);

  //motion.moveQ2(1000);

  //motion.moveQ1(500);
  //usleep(5000000);
  //motion.moveQ2(500);
  //usleep(5000000);
  //motion.moveQ3(500);
  //usleep(5000000);
  //motion.moveQ4(500);
  //usleep(5000000);
}
开发者ID:agawande,项目名称:RobotCode2016,代码行数:30,代码来源:test_motion.cpp

示例3: Motion

void ompl::geometric::FMT::sampleFree(const base::PlannerTerminationCondition &ptc)
{
    unsigned int nodeCount = 0;
    unsigned int sampleAttempts = 0;
    Motion *motion = new Motion(si_);

    // Sample numSamples_ number of nodes from the free configuration space
    while (nodeCount < numSamples_ && !ptc)
    {
        sampler_->sampleUniform(motion->getState());
        sampleAttempts++;

        bool collision_free = si_->isValid(motion->getState());

        if (collision_free)
        {
            nodeCount++;
            nn_->add(motion);
            motion = new Motion(si_);
        } // If collision free
    } // While nodeCount < numSamples
    si_->freeState(motion->getState());
    delete motion;

    // 95% confidence limit for an upper bound for the true free space volume
    freeSpaceVolume_ = boost::math::binomial_distribution<>::find_upper_bound_on_p(sampleAttempts, nodeCount, 0.05) * si_->getStateSpace()->getMeasure();
}
开发者ID:RickOne16,项目名称:ompl,代码行数:27,代码来源:FMT.cpp

示例4: playMotions

void Motion::playMotions() {
  vector<Motion *>::iterator motionIt;
  for (motionIt = cMotions.begin() ; motionIt != cMotions.end(); ++motionIt) {
    Motion *motion = *motionIt;
    motion->playStep();
  }
}
开发者ID:DavidMansolino,项目名称:webots-cross-compilation,代码行数:7,代码来源:Motion.cpp

示例5: Motion

 inline Motion operator^( const Motion& m1, const MotionRevoluteUnaligned & m2)
 {
   /* m1xm2 = [ v1xw2 + w1xv2; w1xw2 ] = [ v1xw2; w1xw2 ] */
   const Motion::Vector3& v1 = m1.linear();
   const Motion::Vector3& w1 = m1.angular();
   const Motion::Vector3& w2 = m2.axis * m2.w ;
   return Motion( v1.cross(w2),w1.cross(w2));
 }
开发者ID:MaximilienNaveau,项目名称:pinocchio,代码行数:8,代码来源:joint-revolute-unaligned.hpp

示例6: set

	void Pose::set(const Motion &motion, MotionChannel::PosType custom_postype, MotionChannel::IsOpen custom_isopen, float keytime)
	{
		for(Motion::const_iterator i = motion.begin(); i != motion.end(); ++i) {
			for(MotionChannelVector::const_iterator j = i->second.begin(); j != i->second.end(); ++j) {
				set(i->first.c_str(), **j, custom_postype, custom_isopen, keytime);
			}
		}
	}
开发者ID:Emulyator,项目名称:gamecatapult,代码行数:8,代码来源:pose.cpp

示例7: EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE

 friend Motion operator* (const ConstraintPlanar &, const Eigen::MatrixBase<D> & v)
 {
   EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(D,3);
   Motion result (Motion::Zero ());
   result.linear ().template head<2> () = v.template topRows<2> ();
   result.angular ().template tail<1> () = v.template bottomRows<1> ();
   return result;
 }
开发者ID:florent-lamiraux,项目名称:pinocchio,代码行数:8,代码来源:joint-planar.hpp

示例8: getMotion

bool  MotionManager::saveMotion(const std::string &animName, const std::string& fileName) //const
{
	 Motion* anim = getMotion(animName);
	if(anim)
	{
		anim->writeToFile(fileName);
		return true;
	}
	return false;
}
开发者ID:dtbinh,项目名称:AncelApp,代码行数:10,代码来源:MotionManager.cpp

示例9: result

    friend Motion operator+ (const MotionPlanar & m1, const Motion & m2)
    {
      Motion result (m2);
      result.linear ()[0] += m1.x_dot_;
      result.linear ()[1] += m1.y_dot_;

      result.angular ()[2] += m1.theta_dot_;

      return result;
    }
开发者ID:florent-lamiraux,项目名称:pinocchio,代码行数:10,代码来源:joint-planar.hpp

示例10: main

int main(){

	int width = 800;
	int height = 600;

	//Game Window
	static Window window("Interstellar Explorer", width, height);
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

	Motion motion;
	Orbit orb1;  //Also this
	Orbit orb2;

	// Construction
	PlayerObject player("Imgs/ship.png"); //Set filename to empty quotes to leave player as polygon
	vector<CircleObject> test = loadPlanets(test, "level.txt");

	//OpenGl Coordinate Grid Setup
	glViewport(0, 0, width, height);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(-width / 2, width / 2, -height / 2, height / 2, 0, 1);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	while (!window.closed()){
		window.clear();

		checkForInput(&window, &motion);

		// Translation
		glPushMatrix();
		motion.applySpeed();
		for (unsigned int i = 0; i < test.size(); i++){
			test[i].Draw();
		}
		glPopMatrix();

		// Rotation
		glPushMatrix();
		motion.applyRotation();
		player.Draw();
		glPopMatrix();

		//Orbits
		glPushMatrix();
		orb1.orbit(test);
		glPopMatrix();

		window.update();
		Sleep(0.5); //Controls how fast the game loop runs
	}

	return 0;
}
开发者ID:bbaeza10001,项目名称:Space-Game-Engine,代码行数:55,代码来源:Main.cpp

示例11: Update

// Update with new frames
void LKTracker::Update(cv::Mat& frame, cv::Mat& next)
{
	MotionVector::iterator iter;

	// Update all tracked region
	for(iter = this->regions.begin(); iter != this->regions.end(); ++iter)
	{
		Motion *motionRegion = *iter;
		motionRegion->Update(frame, next);
	}
}
开发者ID:So-Cool,项目名称:IPCV_video,代码行数:12,代码来源:motion.cpp

示例12:

  Motion operator^ (const Motion & m1, const JointPlanar::MotionPlanar & m2)
  {
    Motion result;

    const Motion::Vector3 & m1_t = m1.linear();
    const Motion::Vector3 & m1_w = m1.angular();

    result.angular () << m1_w(1) * m2.theta_dot_, - m1_w(0) * m2.theta_dot_, 0.;
    result.linear () << m1_t(1) * m2.theta_dot_ - m1_w(2) * m2.y_dot_, - m1_t(0) * m2.theta_dot_ + m1_w(2) * m2.x_dot_, m1_w(0) * m2.y_dot_ - m1_w(1) * m2.x_dot_;

    return result;
  }
开发者ID:florent-lamiraux,项目名称:pinocchio,代码行数:12,代码来源:joint-planar.hpp

示例13: loadData

std::string MotionManager::loadMotion(const std::string& filename)
{
	MatrixXd mat = loadData(filename);
	if (mat.rows() > 0)
	{
		int pos = filename.find_last_of('\\') + 1;
		std::string motionName = filename.substr(pos);
		Motion *anim = new Motion(mat, motionName);
			
		mMotion.push_back(anim);
 		return anim->getName();
 	}
	return "";
}
开发者ID:dtbinh,项目名称:AncelApp,代码行数:14,代码来源:MotionManager.cpp

示例14: while

void ompl::geometric::FMT::traceSolutionPathThroughTree(Motion *goalMotion)
{
    std::vector<Motion*> mpath;
    Motion *solution = goalMotion;

    // Construct the solution path
    while (solution != nullptr)
    {
        mpath.push_back(solution);
        solution = solution->getParent();
    }

    // Set the solution path
    PathGeometric *path = new PathGeometric(si_);
    int mPathSize = mpath.size();
    for (int i = mPathSize - 1 ; i >= 0 ; --i)
        path->append(mpath[i]->getState());
    pdef_->addSolutionPath(base::PathPtr(path), false, -1.0, getName());
}
开发者ID:RickOne16,项目名称:ompl,代码行数:19,代码来源:FMT.cpp

示例15: OnMoveCompleted

void TileEntity::Update() {
	Entity::Update();
	
    // update the fire flicker
    if ( IsOnFire() ) {
        fireDurationCounter++;
        if ( !(fireFlickerVisual->IsPlayingAnimation()) ) {
            fireFlickerVisual->PlayAnimation( fireFlickerAnim );
        }
    }

    // update the motion, if we have one
    if ( !motionQueue.empty() ) {

        Motion * curMotion = motionQueue.front();

        curMotion->Update();

        if ( curMotion->IsDone() ) {
            motionQueue.pop_front();
            pos->SetToClosestTile();
            
            if ( sourceTileLoc != -1 ) {
                // grab current chamber and remove from location
                Chamber * curChamber = (ChamberManager::GetInstance()).GetCurrentChamber();
                curChamber->UnregisterTileEntityInTile( this, sourceTileLoc );
                
                // Call onExtited tile on all tile entities in previous tile
                curChamber->OnEntityExitedTile( this, sourceTileLoc );
                
                // Call onEntered tile on all tile entities except for this one in current tile
                curChamber->OnEntityEnteredTile( this, Chamber::GetTileNumFromPos( pos->GetTileX(), pos->GetTileY() ) );

                // Call onMoveCompleted on self
                OnMoveCompleted( curMotion );
            }

            delete curMotion;
        }

    }
}
开发者ID:tawheeler,项目名称:learn-cpp-01,代码行数:42,代码来源:TileEntity.cpp


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