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


C++ Vec3::set方法代码示例

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


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

示例1: getNormalAtNormalizedLocation

bool
TileModel::ElevationData::getNormal(const osg::Vec3d& ndc,
                                    const GeoLocator* ndcLocator,
                                    osg::Vec3&        output ) const
{
    if ( !_locator.valid() || !ndcLocator )
    {
        output.set(0,0,1);
        return false;
    }

    osg::Vec3d hf_ndc;
    GeoLocator::convertLocalCoordBetween( *ndcLocator, ndc, *_locator.get(), hf_ndc );
    return HeightFieldUtils::getNormalAtNormalizedLocation( _hf.get(), hf_ndc.x(), hf_ndc.y(), output );
}
开发者ID:pka,项目名称:osgearth,代码行数:15,代码来源:TileModel.cpp

示例2: west

bool
TileModel::ElevationData::getNormal(const osg::Vec3d&      ndc,
                                    const GeoLocator*      ndcLocator,
                                    osg::Vec3&             output,
                                    ElevationInterpolation interp ) const
{
    if ( !_locator.valid() || !ndcLocator )
    {
        output.set(0,0,1);
        return false;
    }

    double xcells = (double)(_hf->getNumColumns()-1);
    double ycells = (double)(_hf->getNumRows()-1);
    double xres = 1.0/xcells;
    double yres = 1.0/ycells;

    osg::Vec3d hf_ndc;
    GeoLocator::convertLocalCoordBetween( *ndcLocator, ndc, *_locator.get(), hf_ndc );

    float centerHeight = HeightFieldUtils::getHeightAtNormalizedLocation(_hf.get(), hf_ndc.x(), hf_ndc.y(), interp);

    osg::Vec3d west ( hf_ndc.x()-xres, hf_ndc.y(), 0.0 );
    osg::Vec3d east ( hf_ndc.x()+xres, hf_ndc.y(), 0.0 );
    osg::Vec3d south( hf_ndc.x(), hf_ndc.y()-yres, 0.0 );
    osg::Vec3d north( hf_ndc.x(), hf_ndc.y()+yres, 0.0 );

    if (!HeightFieldUtils::getHeightAtNormalizedLocation(_neighbors, west.x(),  west.y(),  west.z(), interp))
        west.z() = centerHeight;
    if (!HeightFieldUtils::getHeightAtNormalizedLocation(_neighbors, east.x(),  east.y(),  east.z(), interp))
        east.z() = centerHeight;
    if (!HeightFieldUtils::getHeightAtNormalizedLocation(_neighbors, south.x(), south.y(), south.z(), interp))
        south.z() = centerHeight;
    if (!HeightFieldUtils::getHeightAtNormalizedLocation(_neighbors, north.x(), north.y(), north.z(), interp))
        north.z() = centerHeight;

    osg::Vec3d westWorld, eastWorld, southWorld, northWorld;
    _locator->unitToModel(west,  westWorld);
    _locator->unitToModel(east,  eastWorld);
    _locator->unitToModel(south, southWorld);
    _locator->unitToModel(north, northWorld);

    output = (eastWorld-westWorld) ^ (northWorld-southWorld);
    output.normalize();

    return true;
}
开发者ID:MarxGonzalez,项目名称:osgearth,代码行数:47,代码来源:TileModel.cpp

示例3: getYIQ

void Yiq::getYIQ(osg::Vec3& hhh) const
{
    hhh.set(yiq[Y],yiq[I],yiq[Q]);
}
开发者ID:azcbuell,项目名称:OpenEaagles,代码行数:4,代码来源:Yiq.cpp

示例4: convertRotMtxToEuler

// ================================================
// convertRotMtxToEuler
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
void convertRotMtxToEuler( const osg::Matrix &m, osg::Vec3 &euler ) 
{
	osg::Vec3 yaxis( 0., 1., 0. ), zaxis( 0., 0., 1. );
	float heading, pitch, roll;
	
	osg::Vec3 headingv, pitchv, hpnormalv, v;

	pitchv = m.preMult( yaxis );
	headingv = pitchv;
	// zero-out the z component
	headingv[2] = 0.;
	// normalize
	headingv.normalize();
	
	/////////////////////////////////////////////////////////////////
	// HEADING
	/////////////////////////////////////////////////////////////////
	
	// the dot product of the two vectors will get us the cosine of the 
	// angle between them
	float cosH = headingv * yaxis; // dot product
	ARCCOS_SANITY( cosH )
	heading = acos(cosH);
	
	// the cross product of the two vectors will get us the vector normal 
	// to them
	v = headingv ^ yaxis; // cross product
	if( v[2] > 0. )
	{
		heading *= -1.;
	}
	
	
	/////////////////////////////////////////////////////////////////
	// PITCH
	/////////////////////////////////////////////////////////////////
	
	float cosP = pitchv * headingv; // dot product
	ARCCOS_SANITY( cosP )
	pitch = acos(cosP);

	if( pitchv[2] < 0. )
	{
		pitch *= -1.;
	}


	/////////////////////////////////////////////////////////////////
	// ROLL
	/////////////////////////////////////////////////////////////////
	
	hpnormalv = pitchv ^ headingv;
	hpnormalv.normalize();
	// If pitch is negative, hpnormalv will point in the "wrong" direction.
	// In this situation, we'll negate hpnormalv.  If we didn't do this, 
	// we'd get roll values that change sign as pitch changes from positive to 
	// negative or vice versa (yuck).
	if( pitch < 0. )
		hpnormalv *= -1.;
		
	osg::Vec3 zm;
	zm = m.preMult( zaxis );

/*
cout << "vv color " << "zm" << " 0.5 0.5 1.0\n";
cout << "vv set zm " << zm  << endl;
cout << "vv color pitchv 1 0 1\n";
cout << "vv set pitchv " << pitchv  << endl;
cout << "vv color headingv 1 .5 1\n";
cout << "vv set headingv " << headingv  << endl;
cout << "vv color " << "hpnormalv" << " 1. 1. 1.\n";
cout << "vv set hpnormalv " << hpnormalv << endl;
*/
	
	float cosR = zm * hpnormalv;
	ARCCOS_SANITY( cosR )
	roll = acos(cosR);
	// if the normal is roughly coincident with pitchv, then we need 
	// to negate the sign of the roll angle
	osg::Vec3 rollplanenormalv = zm ^ hpnormalv;
	rollplanenormalv.normalize();
//cout << "vv color " << "rollplanenormalv" << " .3 .3 .3\n";
//cout << "vv set rollplanenormalv " << rollplanenormalv << endl;
	if( pitchv * rollplanenormalv > 0. )
	{
		roll *= -1.;
	}
	
	euler.set( roll, pitch, heading );
//cout << "r p h " << euler << endl;
}
开发者ID:aughey,项目名称:mpv,代码行数:94,代码来源:MultiEmitter.cpp

示例5: menuCallback

void CameraFlight::menuCallback(cvr::MenuItem * item)
{
    if (item == _instant)
    {
	if(activeMode != item)
	{
	    activeMode->setValue(false);
	    std::cerr<<"Instant Transition has selected"<<std::endl;
	}

	activeMode = _instant;
	_instant->setValue(true);
	_flightMode = INSTANT;
    }

    else if (item == _satellite)
    {
	if(activeMode != item)
	{
	    activeMode->setValue(false);
	    std::cerr<<"Satellite Transition has selected"<<std::endl;
	}

	activeMode = _satellite;
	_satellite->setValue(true);
	_flightMode = SATELLITE;
    }

    else if (item == _reset)
    {
	if(activeMode != item)
	{
	    activeMode->setValue(false);
	    std::cerr<<"Reset Back to original"<<std::endl;
	}

	activeMode = _reset;
	_reset->setValue(true);
	
	SceneManager::instance()->setObjectMatrix(_origMatrix);
	SceneManager::instance()->setObjectScale(_origScale);
    }

    else if (item == _dest1)
    {
	if(destMode != item && destMode != NULL)
	{
	    destMode->setValue(false);
	    _dest1->setValue(true);
	}

	if(destMode != item) {
	    destMode = _dest1;
	    _destMat.set(_destMat1);
	    _destVec.set(0.573827, -2.04617, 0.0);
	    navigate(_destMat, _destVec);
	}
	else {
	    destMode = _dest1;
	}
	
    }

    else if (item == _dest2)
    {
	if(destMode != item && destMode != NULL)
	{
	    destMode->setValue(false);
	}

	destMode = _dest2;
	_dest2->setValue(true);
	_destMat.set(_destMat2);
	_destVec.set(0.622566, 2.43884, 0.0);
	navigate(_destMat, _destVec);
    }

    else if (item == _dest3)
    {
	if(destMode != item && destMode != NULL)
	{
	    destMode->setValue(false);
	}

	destMode = _dest3;
	_dest3->setValue(true);
	_destMat.set(_destMat3);
	_destVec.set(-1.51126, 1.54642, 0.0);
	navigate(_destMat, _destVec);
    }

    else if (item == _dest4)
    {
	if(destMode != item && destMode != NULL)
	{
	    destMode->setValue(false);
	}

	destMode = _dest4;
	_dest4->setValue(true);
//.........这里部分代码省略.........
开发者ID:aprudhomme,项目名称:calvr_plugins,代码行数:101,代码来源:CameraFlight.cpp

示例6: getCMY

void Cmy::getCMY(osg::Vec3& hhh) const
{
    hhh.set(cmy[CYAN],cmy[MAGENTA],cmy[YELLOW]);
}
开发者ID:AFIT-Hodson,项目名称:OpenEaagles,代码行数:4,代码来源:Cmy.cpp

示例7: getCIE

void Cie::getCIE(osg::Vec3& hhh) const
{
    hhh.set(cie[LUMINANCE],cie[X],cie[Y]);
}
开发者ID:jmc734,项目名称:OpenEaagles,代码行数:4,代码来源:Cie.cpp

示例8: getHSV

void Hsv::getHSV(osg::Vec3& hhh) const
{
    hhh.set(hsv[HUE],hsv[SATURATION],hsv[VALUE]);
}
开发者ID:derekworth,项目名称:afit-swarm-simulation,代码行数:4,代码来源:Hsv.cpp


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