本文整理汇总了C++中osg::Matrix::getTrans方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix::getTrans方法的具体用法?C++ Matrix::getTrans怎么用?C++ Matrix::getTrans使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Matrix
的用法示例。
在下文中一共展示了Matrix::getTrans方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: t
void
SoundUpdateCB::operator()( osg::Node* node, osg::NodeVisitor* nv )
{
const osg::FrameStamp* fs( nv->getFrameStamp() );
if( !m_sound_state.valid() || ( fs == NULL ) )
{
// Early exit.
osg::notify(osg::DEBUG_INFO) << "SoundUpdateCB::operator()() No SoundState attached, or invalid FrameStamp." << std::endl;
traverse( node, nv );
return;
}
const double t( fs->getReferenceTime() );
const double time( t - m_last_time );
if(time >= m_sound_manager->getUpdateFrequency())
{
const osg::Matrix m( osg::computeLocalToWorld( nv->getNodePath() ) );
const osg::Vec3 pos = m.getTrans();
m_sound_state->setPosition(pos);
//Calculate velocity
osg::Vec3 velocity(0,0,0);
if (m_first_run)
{
m_first_run = false;
m_last_time = t;
m_last_pos = pos;
}
else
{
velocity = pos - m_last_pos;
m_last_pos = pos;
m_last_time = t;
velocity /= time;
}
if(m_sound_manager->getClampVelocity())
{
float max_vel = m_sound_manager->getMaxVelocity();
float len = velocity.length();
if ( len > max_vel)
{
velocity.normalize();
velocity *= max_vel;
}
}
m_sound_state->setVelocity(velocity);
//Get new direction
osg::Vec3 dir = osg::Vec3( 0., 1., 0. ) * m;
dir.normalize();
m_sound_state->setDirection(dir);
// Only do occlusion calculations if the sound is playing
if (m_sound_state->getPlay() && m_occlude_callback.valid())
m_occlude_callback->apply(m_sound_manager->getListenerMatrix(), pos, m_sound_state.get());
} // if time to update
traverse( node, nv );
}
示例2: getPlaneIntersection
bool SceneUtils::getPlaneIntersection(opencover::coPlane *plane, osg::Matrix pointerMat, osg::Vec3 &point)
{
osg::Vec3 pointerPos1, pointerPos2, pointerDir;
pointerPos1 = pointerMat.getTrans();
pointerDir[0] = pointerMat(1, 0);
pointerDir[1] = pointerMat(1, 1);
pointerDir[2] = pointerMat(1, 2);
pointerPos2 = pointerPos1 + pointerDir;
return plane->getLineIntersectionPoint(pointerPos1, pointerPos2, point);
}
示例3: isTransOutlier
bool TransformFilterCallback::isTransOutlier(const osg::Matrix& matrix){
// check if new matrix is likely to be an outlier by comparing translations
osg::Vec3d new_trans = matrix.getTrans(); // new translation
osg::Vec3d connect = m_storedTranslation - new_trans; // connecting vector
//std::cout << "trans_diff: " << connect.length() << std::endl;
if (connect.length() > m_TransOutlierDistance)
{
//std::cout << "TransformFilterCallback::isTransOutlier:/ rejected translational outlier" << std::endl;
return true;
}
return false;
}
示例4: setByMatrix
void PanoManipulator::setByMatrix(const osg::Matrix& matrix)
{
_eye = matrix.getTrans();
_rotation.set(matrix);
} // PanoManipulator::setByMatrix