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


C++ btVector3::distance方法代码示例

本文整理汇总了C++中btVector3::distance方法的典型用法代码示例。如果您正苦于以下问题:C++ btVector3::distance方法的具体用法?C++ btVector3::distance怎么用?C++ btVector3::distance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在btVector3的用法示例。


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

示例1: goForGoal

void pathPlan::goForGoal(btVector3 start, btVector3 end)
{
	memset(&m_startPoint,0,sizeof(rankPoint));
	m_startPoint.point = start;
	memset(&m_goalPoint,0,sizeof(rankPoint));
	m_goalPoint.point = end;
	
	m_state = PS_SEARCHING;
	m_straightDistance = start.distance(end);
	m_progressLimit = m_straightDistance / m_efficiencyLimit;
	m_spinDirection = 0;
	
	displayCurrentSearch(true);								// turn on drawing the yellow search lines
	displayBuildPath(true);
	
	if(m_view) m_view->overlayString(QString("Searching Range %1").arg(m_range));
	
	m_time.start();											// start time of path calculation
	
	if(m_range == 0) {
		m_state = this->AStarSearch();						// if infinite range find the shortest path
	}
	else {
		m_state = this->cycleToGoal();						// step forward on path until the goal is in range

		m_GP.points = m_trailPath + m_GP.points;			// prepend the step trail point list
		m_trailPath.clear();
		m_GP.length = 0;
		for(int i=0; i<m_GP.points.size()-1; i++) 
			m_GP.length += m_GP.points[i].point.distance(m_GP.points[i+1].point);	// calculate the total length
		m_startPoint = m_GP.points[0];						// set the starting point for drawing
	}
	
	if(m_goalOccluded && m_state == PS_COMPLETE) 			// path is complete but the goal is occluded
		m_state = PS_GOALOCCLUDED;							// set the state
	
	m_GP.time = m_time.elapsed();							// get the elapsed time for the path generation
	
	if(m_CS) delete m_CS;									// delete the C Space to free up memory since it is not needed
	m_CS = 0;
	m_pointPath.clear();									// clear out the construction point path
	
	displayCurrentSearch(false);							// turn off search path drawing
	displayBuildPath(false);
	displayPath(true);
			
	if(m_GP.length != 0) m_GP.efficiency = m_straightDistance/m_GP.length;
}
开发者ID:jsj2008,项目名称:roverSim,代码行数:48,代码来源:pathPlan.cpp

示例2: s

/**
 * @brief Test collision object if it is in the collision distance from the robot
 *
 * @param point Position of the object center - in the world coordinates
 * @param extent Bounding sphere of the collision object
 * @return
 */
bool srs_env_model::CCMapPlugin::isNearRobot( const btVector3 & point, double extent )
{
	btScalar s( point.distance( m_robotBasePosition ) );

	return s - extent < m_collisionMapLimitRadius;
}
开发者ID:vstancl,项目名称:srs_public,代码行数:13,代码来源:cmap_plugin.cpp


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