• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dist_vec函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setSpeaker

void LLLocalSpeakerMgr::updateSpeakerList()
{
	// pull speakers from voice channel
	LLSpeakerMgr::updateSpeakerList();

	// add non-voice speakers in chat range
	std::vector< LLCharacter* >::iterator avatar_it;
	for(avatar_it = LLCharacter::sInstances.begin(); avatar_it != LLCharacter::sInstances.end(); ++avatar_it)
	{
		LLVOAvatar* avatarp = (LLVOAvatar*)*avatar_it;
		if (!avatarp->isDead() &&  dist_vec(avatarp->getPositionAgent(), gAgent.getPositionAgent()) <= CHAT_NORMAL_RADIUS)
		{
			setSpeaker(avatarp->getID());
		}
	}

	// check if text only speakers have moved out of chat range
	for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
	{
		LLUUID speaker_id = speaker_it->first;
		LLSpeaker* speakerp = speaker_it->second;
		if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY)
		{
			LLVOAvatar* avatarp = (LLVOAvatar*)gObjectList.findObject(speaker_id);
			if (!avatarp || avatarp->isDead() || dist_vec(avatarp->getPositionAgent(), gAgent.getPositionAgent()) > CHAT_NORMAL_RADIUS)
			{
				speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL;
				speakerp->mDotColor = INACTIVE_COLOR;
				speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT);
			}
		}
	}
}
开发者ID:Boy,项目名称:netbook,代码行数:33,代码来源:llfloateractivespeakers.cpp


示例2:

RealGradient
SmoothSuperellipsoidBaseIC::computeSuperellipsoidGradient(const Point & p, const Point & center, const Real & a, const Real & b, const Real & /*c*/, const Real & n)
{
  Point l_center = center;
  Point l_p = p;
  //Compute the distance between the current point and the center
  Real dist = _mesh.minPeriodicDistance(_var.number(), l_p, l_center);

  //Compute the distance r from the center of the superellipsoid to its outside edge
  //along the vector from the center to the current point
  //This uses the equation for a superellipse in polar coordinates and substitutes
  //distances for sin, cos functions
  Point dist_vec = _mesh.minPeriodicVector(_var.number(), center, p);
  //First calculate rmn = r^(-n)
  Real rmn = (std::pow(std::abs(dist_vec(0)/dist/a), n) +  std::pow(std::abs(dist_vec(1)/dist/b), n));
  //Then calculate r
  Real r = std::pow(rmn, (-1.0/n));

  Real DvalueDr = 0.0;

  if (dist < r + _int_width/2.0 && dist > r - _int_width/2.0)
  {
    Real int_pos = (dist - r + _int_width / 2.0) / _int_width;
    Real Dint_posDr = 1.0 / _int_width;
    DvalueDr = Dint_posDr * (_invalue - _outvalue) * (-std::sin(int_pos * libMesh::pi) * libMesh::pi) / 2.0;
  }

  //Set gradient over the smooth interface
  if (dist != 0.0)
    return dist_vec * (DvalueDr / dist);
  else
    return 0.0;
}
开发者ID:cpgr,项目名称:moose,代码行数:33,代码来源:SmoothSuperellipsoidBaseIC.C


示例3: dist_vec

void QToolAlign::computeManipulatorSize()
{
	if (LLSelectMgr::getInstance()->getSelection()->getSelectType() == SELECT_TYPE_HUD)
	{
		mManipulatorSize = MANIPULATOR_SIZE / (LLViewerCamera::getInstance()->getViewHeightInPixels() *
											   gAgentCamera.mHUDCurZoom);
	}
	else
	{
		F32 distance = dist_vec(gAgentCamera.getCameraPositionAgent(), mBBox.getCenterAgent());

		if (distance > 0.001f)
		{
			// range != zero
			F32 fraction_of_fov = MANIPULATOR_SIZE /LLViewerCamera::getInstance()->getViewHeightInPixels();
			F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView();  // radians
			mManipulatorSize = MANIPULATOR_SIZE * distance * tan(apparent_angle);
		}
		else
		{
			// range == zero
			mManipulatorSize = MANIPULATOR_SIZE;
		}
	}
}
开发者ID:OS-Development,项目名称:VW.Dolphin_v3,代码行数:25,代码来源:qtoolalign.cpp


示例4: Vec3f

void FEdgeXDetector::preProcessFace(WXFace *iFace)
{
	Vec3f firstPoint = iFace->GetVertex(0)->GetVertex();
	Vec3f N = iFace->GetNormal();

	// Compute the dot product between V (=_Viewpoint - firstPoint) and N:
	Vec3f V;
	if (_orthographicProjection) {
		V = Vec3f(0.0f, 0.0f, _Viewpoint.z() - firstPoint.z());
	}
	else {
		V = Vec3f(_Viewpoint - firstPoint);
	}
	N.normalize();
	V.normalize();
	iFace->setDotP(N * V);

	// compute the distance between the face center and the viewpoint:
	if (_orthographicProjection) {
		iFace->setZ(iFace->center().z() - _Viewpoint.z());
	}
	else {
		Vec3f dist_vec(iFace->center() - _Viewpoint);
		iFace->setZ(dist_vec.norm());
	}
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:26,代码来源:FEdgeXDetector.cpp


示例5: unpackLocalToGlobalPosition

void LLWorld::getAvatars(std::vector<LLUUID>* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const
{
	if(avatar_ids != NULL)
	{
		avatar_ids->clear();
	}
	if(positions != NULL)
	{
		positions->clear();
	}
	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
		iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
	{
		LLViewerRegion* regionp = *iter;
		const LLVector3d& origin_global = regionp->getOriginGlobal();
		S32 count = regionp->mMapAvatars.count();
		for (S32 i = 0; i < count; i++)
		{
			LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global);
			if(dist_vec(pos_global, relative_to) <= radius)
			{
				if(positions != NULL)
				{
					positions->push_back(pos_global);
				}
				if(avatar_ids != NULL)
				{
					avatar_ids->push_back(regionp->mMapAvatarIDs.get(i));
				}
			}
		}
	}
}
开发者ID:CharleyLevenque,项目名称:SingularityViewer,代码行数:33,代码来源:llworld.cpp


示例6: switch

//static 
void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color)
{
	if(chat.mMuted)
	{
		r_color= LLUIColorTable::instance().getColor("LtGray");
	}
	else
	{
		switch(chat.mSourceType)
		{
			case CHAT_SOURCE_SYSTEM:
				r_color = LLUIColorTable::instance().getColor("SystemChatColor"); 
				break;
			case CHAT_SOURCE_AGENT:
				if (chat.mFromID.isNull() || SYSTEM_FROM == chat.mFromName)
				{
					r_color = LLUIColorTable::instance().getColor("SystemChatColor");
				}
				else
				{
					if(gAgentID == chat.mFromID)
					{
						r_color = LLUIColorTable::instance().getColor("UserChatColor");
					}
					else
					{
						r_color = LLUIColorTable::instance().getColor("AgentChatColor");
					}
				}
				break;
			case CHAT_SOURCE_OBJECT:
				if (chat.mChatType == CHAT_TYPE_DEBUG_MSG)
				{
					r_color = LLUIColorTable::instance().getColor("ScriptErrorColor");
				}
				else if ( chat.mChatType == CHAT_TYPE_OWNER )
				{
					r_color = LLUIColorTable::instance().getColor("llOwnerSayChatColor");
				}
				else
				{
					r_color = LLUIColorTable::instance().getColor("ObjectChatColor");
				}
				break;
			default:
				r_color.setToWhite();
		}
		
		if (!chat.mPosAgent.isExactlyZero())
		{
			LLVector3 pos_agent = gAgent.getPositionAgent();
			F32 distance = dist_vec(pos_agent, chat.mPosAgent);
			if (distance > gAgent.getNearChatRadius())
			{
				// diminish far-off chat
				r_color.mV[VALPHA] = 0.8f;
			}
		}
	}
}
开发者ID:HyangZhao,项目名称:NaCl-main,代码行数:61,代码来源:llviewerchat.cpp


示例7: setSpeaker

void LLLocalSpeakerMgr::updateSpeakerList()
{
	// pull speakers from voice channel
	LLSpeakerMgr::updateSpeakerList();

	if (gDisconnected)//the world is cleared.
	{
		return ;
	}

	// pick up non-voice speakers in chat range
	uuid_vec_t avatar_ids;
	std::vector<LLVector3d> positions;
	LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgent.getPositionGlobal(), CHAT_NORMAL_RADIUS);
	for(U32 i=0; i<avatar_ids.size(); i++)
	{
		setSpeaker(avatar_ids[i]);
	}

	// check if text only speakers have moved out of chat range
	for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
	{
		LLUUID speaker_id = speaker_it->first;
		LLSpeaker* speakerp = speaker_it->second;
		if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY)
		{
			LLVOAvatar* avatarp = (LLVOAvatar*)gObjectList.findObject(speaker_id);
			if (!avatarp || dist_vec(avatarp->getPositionAgent(), gAgent.getPositionAgent()) > CHAT_NORMAL_RADIUS)
			{
				setSpeakerNotInChannel(speakerp);
			}
		}
	}
}
开发者ID:Katharine,项目名称:kittyviewer,代码行数:34,代码来源:llspeakers.cpp


示例8: setLookAt

//-----------------------------------------------------------------------------
// setLookAt()
// called by agent logic to set look at behavior locally, and propagate to sim
//-----------------------------------------------------------------------------
BOOL LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position)
{
	if (!mSourceObject)
	{
		return FALSE;
	}
	
	if (target_type >= LOOKAT_NUM_TARGETS)
	{
		llwarns << "Bad target_type " << (int)target_type << " - ignoring." << llendl;
		return FALSE;
	}

	// must be same or higher priority than existing effect
	if ((*mAttentions)[target_type].mPriority < (*mAttentions)[mTargetType].mPriority)
	{
		return FALSE;
	}

	F32 current_time  = mTimer.getElapsedTimeF32();

	// type of lookat behavior or target object has changed
	BOOL lookAtChanged = (target_type != mTargetType) || (object != mTargetObject);

	// lookat position has moved a certain amount and we haven't just sent an update
	lookAtChanged = lookAtChanged || ((dist_vec(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE) && 
		((current_time - mLastSendTime) > (1.f / MAX_SENDS_PER_SEC)));

	if (lookAtChanged)
	{
		mLastSentOffsetGlobal = position;
		F32 timeout = (*mAttentions)[target_type].mTimeout;
		setDuration(timeout);
		setNeedsSendToSim(TRUE);
	}
 
	if (target_type == LOOKAT_TARGET_CLEAR)
	{
		clearLookAtTarget();
	}
	else
	{
		mTargetType = target_type;
		mTargetObject = object;
		if (object)
		{
			mTargetOffsetGlobal.setVec(position);
		}
		else
		{
			mTargetOffsetGlobal = gAgent.getPosGlobalFromAgent(position);
		}
		mKillTime = mTimer.getElapsedTimeF32() + mDuration;

		update();
	}
	return TRUE;
}
开发者ID:Kiera,项目名称:Crow,代码行数:62,代码来源:llhudeffectlookat.cpp


示例9: find

void LLFloaterHUD::find() // Scanner activated by Scan button
{
	if(mHalt) return; // this basically checks if the scan has been toggled on or off otherwise llvoavatar calls the scan on avatar activity
	

	mListNames->deleteAllItems(); //Clear the list

		
	std::vector< LLCharacter* >::iterator avatar_it;
	for(avatar_it = LLCharacter::sInstances.begin(); avatar_it != LLCharacter::sInstances.end(); ++avatar_it)
	{
		LLVOAvatar* avatarp = (LLVOAvatar*)*avatar_it;

		if (avatarp->isDead() || avatarp->isSelf()) //Dont show the user!
		{
			continue;
		} 

		if (dist_vec(avatarp->getPositionAgent(), gAgent.getPositionAgent()) <= SCAN_MAX_RADIUS) //Scanner radius set in indra constants.
		{
			
			// Pull in that avatar data!
			std::string name = avatarp->getFullname();
			LLVector3d position = gAgent.getPosGlobalFromAgent(avatarp->getCharacterPosition());
		    LLUUID avid = avatarp->getID();

		    // Work out distance relative to user!
			LLVector3d mypos = gAgent.getPositionGlobal();
            LLVector3d delta = position - mypos;
		    F32 distance = (F32)delta.magVec();

            //Build the list
			LLSD element;

            element["id"] = avid;

			element["columns"][LIST_AVATAR_NAME]["column"] = "name";
			element["columns"][LIST_AVATAR_NAME]["value"] = name;

            element["columns"][LIST_DISTANCE]["column"] = "distance";
			element["columns"][LIST_DISTANCE]["value"] = distance;

			
            mListNames->addElement(element);
		 
            mListNames->sortByColumn("distance", TRUE);
			mListNames->setCallbackUserData(this);
			

		}

	}
   return;	
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:54,代码来源:llfloaterhud.cpp


示例10: vec4

	void v4math_object::test<19>()
	{
		F32 x1 =-2.3f, y1 = 2.f,z1 = 1.2f, x2 = 1.3f, y2 = 1.f, z2 = 1.f;
		F32 val1,val2;
		LLVector4 vec4(x1,y1,z1),vec4a(x2,y2,z2);
		val1 = dist_vec(vec4,vec4a);
		val2 = fsqrtf((x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2) + (z1 - z2)* (z1 -z2));
		ensure_equals("dist_vec: Fail ",val2, val1);
		val1 = dist_vec_squared(vec4,vec4a);
		val2 =((x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2) + (z1 - z2)* (z1 -z2));
		ensure_equals("dist_vec_squared: Fail ",val2, val1);
	}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:12,代码来源:v4math_tut.cpp


示例11: V

void FEdgeXDetector::preProcessFace(WXFace *iFace){
    Vec3r firstPoint = iFace->GetVertex(0)->GetVertex();
    Vec3r N = iFace->GetNormal();

    // Compute the dot product between V (=_Viewpoint - firstPoint) and N:
    Vec3r V(_Viewpoint - firstPoint);
    N.normalize();
    V.normalize();
    iFace->SetDotP(N * V);

    // compute the distance between the face center and the viewpoint:
    Vec3r dist_vec(iFace->center() - _Viewpoint);
    iFace->SetZ(dist_vec.norm());
}
开发者ID:GodZza,项目名称:contours,代码行数:14,代码来源:FEdgeXDetector.cpp


示例12: if

Real
SmoothSuperellipsoidBaseIC::computeSuperellipsoidValue(const Point & p, const Point & center, const Real & a, const Real & b, const Real & c, const Real & n)
{
  Point l_center = center;
  Point l_p = p;
  //Compute the distance between the current point and the center
  Real dist = _mesh.minPeriodicDistance(_var.number(), l_p, l_center);

  //When dist is 0 we are exactly at the center of the superellipsoid so return _invalue
  //Handle this case independently because we cannot calculate polar angles at this point
  if (dist == 0.0) return _invalue;

  //Compute the distance r from the center of the superellipsoid to its outside edge
  //along the vector from the center to the current point
  //This uses the equation for a superellipse in polar coordinates and substitutes
  //distances for sin, cos functions
  Point dist_vec = _mesh.minPeriodicVector(_var.number(), center, p);

  //First calculate rmn = r^(-n), replacing sin, cos functions with distances
  Real rmn = (std::pow(std::abs(dist_vec(0) / dist / a), n)
            + std::pow(std::abs(dist_vec(1) / dist / b), n)
            + std::pow(std::abs(dist_vec(2) / dist / c), n) );
  //Then calculate r from rmn
  Real r = std::pow(rmn, (-1.0/n));

  Real value = _outvalue; //Outside superellipsoid

  if (dist <= r - _int_width/2.0) //Inside superellipsoid
    value = _invalue;
  else if (dist < r + _int_width/2.0) //Smooth interface
  {
    Real int_pos = (dist - r + _int_width/2.0)/_int_width;
    value = _outvalue + (_invalue - _outvalue) * (1.0 + std::cos(int_pos * libMesh::pi)) / 2.0;
  }

  return value;
}
开发者ID:cpgr,项目名称:moose,代码行数:37,代码来源:SmoothSuperellipsoidBaseIC.C


示例13: WXFaceLayer

void FEdgeXDetector::ProcessSilhouetteFace(WXFace *iFace, bool meshSilhouettes)
{

    real NdotVepsilonHack = 0;// 0.05; //0.1; //0.01; //0.1;

    // SILHOUETTE LAYER
    // Compute the dot products between View direction and N at each vertex
    // of the face:
    Vec3r point;
    int closestPointId = 0;
    real dist, minDist = FLT_MAX;
    int numVertices = iFace->numberOfVertices();
    WXFaceLayer * faceLayer = new WXFaceLayer(iFace, Nature::SILHOUETTE, true);

    Vec3r normal;
    if(meshSilhouettes){
        // Use per face normal
        normal = (iFace->GetVertex(2)->GetVertex() - iFace->GetVertex(0)->GetVertex()) ^ (iFace->GetVertex(1)->GetVertex() - iFace->GetVertex(0)->GetVertex());
        normal.normalize();
    }

    for(int i=0; i<numVertices; i++){
        point = iFace->GetVertex(i)->GetVertex();
        if(!meshSilhouettes){
            // Use per vertex normal
            normal = iFace->GetVertexNormal(i);
            normal.normalize();
        }
        Vec3r V(_Viewpoint - point);
        V.normalize();
        real d = normal * V + NdotVepsilonHack;
        faceLayer->PushDotP(d);
        // Find the point the closest to the viewpoint
        Vec3r dist_vec(point - _Viewpoint);
        dist = dist_vec.norm();
        if(dist < minDist) {
            minDist = dist;
            closestPointId = i;
        }

        // store ndotv at the vertex for use in the region-based visibility
        //    assert(dynamic_cast<WXVertex*>(iFace->GetVertex(i))!=NULL);
        ((WXVertex*)iFace->GetVertex(i))->setNdotV(d);
    }
    // Set the closest point id:
    faceLayer->SetClosestPointIndex(closestPointId);
    // Add this layer to the face:
    iFace->AddSmoothLayer(faceLayer);
}
开发者ID:GodZza,项目名称:contours,代码行数:49,代码来源:FEdgeXDetector.cpp


示例14: vec3

	void v3math_object::test<31>()
	{
		F32 x1 =-2.3f, y1 = 2.f,z1 = 1.2f, x2 = 1.3f, y2 = 1.f, z2 = 1.f;
		F32 val1,val2;
		LLVector3 vec3(x1,y1,z1),vec3a(x2,y2,z2);
		val1 = dist_vec(vec3,vec3a);
		val2 = fsqrtf((x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2) + (z1 - z2)* (z1 -z2));
		ensure_equals("1:dist_vec: Fail ",val2, val1);
		val1 = dist_vec_squared(vec3,vec3a);
		val2 =((x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2) + (z1 - z2)* (z1 -z2));
		ensure_equals("2:dist_vec_squared: Fail ",val2, val1);
		val1 = dist_vec_squared2D(vec3, vec3a);
		val2 =(x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2);
		ensure_equals("3:dist_vec_squared2D: Fail ",val2, val1);
	}
开发者ID:HyangZhao,项目名称:NaCl-main,代码行数:15,代码来源:v3math_test.cpp


示例15: colorf

void lggBeamMaps::fireCurrentBeams(LLPointer<LLHUDEffectSpiral> mBeam, const LLColor4U& rgb)
{
	if (mScale == 0.0f)
	{
		return;
	}

	static LLCachedControl<std::string> colorf(gSavedSettings, "FSBeamColorFile");
	bool colorsDisabled = (colorf().empty());
	
	for (std::vector<lggBeamData>::iterator it = mDots.begin(); it != mDots.end(); ++it)
	{
		LLColor4U myColor = rgb;
		if (colorsDisabled)
		{
			myColor = (*it).c;
		}

		F32 distanceAdjust = dist_vec(mBeam->getPositionGlobal(), gAgent.getPositionGlobal());
		F32 pulse = (F32)(.75f + sinf(gFrameTimeSeconds * 1.0f) * 0.25f);
		LLVector3d offset = (*it).p;
		offset.mdV[VY] *= -1.f;
		offset *= pulse * mScale * distanceAdjust * 0.1f;
		
		LLVector3 beamLine = LLVector3( mBeam->getPositionGlobal() - gAgent.getPositionGlobal());
		LLVector3 beamLineFlat = beamLine;
		beamLineFlat.mV[VZ]= 0.0f;

		LLVector3 newDirFlat = LLVector3::x_axis;
		beamLine.normalize();
		beamLineFlat.normalize();
		LLQuaternion change;
		change.shortestArc(newDirFlat, beamLineFlat);
		offset.rotVec(change);
		newDirFlat.rotVec(change);
		change.shortestArc(newDirFlat, beamLine);
		offset.rotVec(change);

		LLPointer<LLHUDEffectSpiral> myBeam = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM);
		myBeam->setPositionGlobal(mBeam->getPositionGlobal() + offset + (LLVector3d(beamLine) * sinf(gFrameTimeSeconds * 2.0f) * 0.2f));
		
		myBeam->setColor(myColor);
		myBeam->setTargetObject(mBeam->getTargetObject());
		myBeam->setSourceObject(mBeam->getSourceObject());
		myBeam->setNeedsSendToSim(mBeam->getNeedsSendToSim());
		myBeam->setDuration(mDuration * 1.2f);
	}
}
开发者ID:gabeharms,项目名称:firestorm,代码行数:48,代码来源:lggbeammaps.cpp


示例16: vec2

	void v2math_object::test<21>()
	{
		F32 x1 =1.f, y1 = 2.f, x2 = -.32f, y2 = .2234f;
		F32 val1, val2;
		LLVector2 vec2(x1, y1),vec3(x2, y2);		
		val1 = dist_vec_squared2D(vec2, vec3);
		val2 = (x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2);
		ensure_equals("dist_vec_squared2D values are not equal",val2, val1);

		val1 = dist_vec_squared(vec2, vec3);
		ensure_equals("dist_vec_squared values are not equal",val2, val1);

		val1 = 	dist_vec(vec2, vec3);
		val2 = fsqrtf((x1 - x2)*(x1 - x2) + (y1 - y2)* (y1 - y2));
		ensure_equals("dist_vec values are not equal",val2, val1);
	}
开发者ID:Boy,项目名称:netbook,代码行数:16,代码来源:v2math_tut.cpp


示例17: colorf

void lggBeamMaps::fireCurrentBeams(LLPointer<LLHUDEffectSpiral> mBeam, LLColor4U rgb)
{
	if (scale == 0.0f)
	{
		return;
	}

	static LLCachedControl<std::string> colorf(gSavedSettings, "FSBeamColorFile");
	bool colorsDisabled = std::string(colorf) == "===OFF===";
	
	for(int i = 0; i < (int)dots.size(); i++)
	{
		LLColor4U myColor = rgb;
		if (colorsDisabled) myColor = dots[i].c;

		F32 distanceAdjust = dist_vec(mBeam->getPositionGlobal(),gAgent.getPositionGlobal()) ;
		F32 pulse = (F32)(.75f+sinf(gFrameTimeSeconds*1.0f)*0.25f);
		LLVector3d offset = dots[i].p;
		offset.mdV[VY] *= -1;
		offset *= pulse * scale * distanceAdjust * 0.1;
		
		//llinfos << "dist is " << distanceAdjust << "scale is " << scale << llendl;
		LLVector3 beamLine = LLVector3( mBeam->getPositionGlobal() - gAgent.getPositionGlobal());
		LLVector3 beamLineFlat = beamLine;
		beamLineFlat.mV[VZ]= 0.0f;

		LLVector3 newDirFlat = LLVector3::x_axis;
		beamLine.normalize();
		beamLineFlat.normalize();
		LLQuaternion change;
		change.shortestArc(newDirFlat,beamLineFlat);
		offset.rotVec(change);
		newDirFlat.rotVec(change);
		change.shortestArc(newDirFlat,beamLine);
		offset.rotVec(change);

		LLPointer<LLHUDEffectSpiral> myBeam =  (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM);
		myBeam->setPositionGlobal(mBeam->getPositionGlobal() + offset + (LLVector3d(beamLine) * sinf(gFrameTimeSeconds*2.0f) * 0.2f));
		
		myBeam->setColor(myColor);
		myBeam->setTargetObject(mBeam->getTargetObject());
		myBeam->setSourceObject(mBeam->getSourceObject());
		myBeam->setNeedsSendToSim(mBeam->getNeedsSendToSim());
		myBeam->setDuration(duration* 1.2f);
	}
}
开发者ID:JohnMcCaffery,项目名称:Armadillo-Phoenix,代码行数:46,代码来源:lggbeammaps.cpp


示例18: F32

F32 PanelRadar::calculateDistance(const LLUUID& agent_id, LLVector3d agent_position)
{
	// LL only sends height value up to 1024m, try to work around it if we can by using draw distance
	if (agent_position.mdV[VZ] == 0.0f)
	{
		LLViewerObject *av_obj = gObjectList.findObject(agent_id);
		if (av_obj != NULL && av_obj->isAvatar())
		{
			LLVOAvatar* avatarp = (LLVOAvatar*)av_obj;
			if (avatarp != NULL)
			{
				agent_position = avatarp->getPositionGlobal();
			}
		}
	}
	return F32(dist_vec(agent_position, gAgent.getPositionGlobal())); // don't need F64 here (what dist_vec returns)
}
开发者ID:ArminW,项目名称:imprudence,代码行数:17,代码来源:panelradar.cpp


示例19: handleRightMouseDown

BOOL lggBeamMapFloater::handleRightMouseDown(S32 x,S32 y,MASK mask)
{
	std::vector<lggPoint> newDots;
	for(int i = 0; i < (int)dots.size();i++)
	{
		if(dist_vec(LLVector2(x,y),LLVector2(dots[i].x,dots[i].y)) < 7)
		{
			
		}else
		{
			newDots.push_back(dots[i]);
		}
	
	}
	dots = newDots;
		
	return LLFloater::handleMouseDown(x,y,mask);
}
开发者ID:Xara,项目名称:Immortality,代码行数:18,代码来源:lggbeammapfloater.cpp


示例20: getOriginGlobal

void LLViewerRegion::getAvatars	( LLUUIDList& avatar_ids
								, const LLVector3d& relative_to
								, F32 radius
								) const
{
	avatar_ids.clear();
	//
	const LLVector3d& origin_global = getOriginGlobal();
	S32 count = mMapAvatars.count();
	for (S32 i = 0; i < count; i++)
	{
		LLVector3d pos_global = unpackLocalToGlobalPosition( mMapAvatars.get(i), origin_global );
		const F32 distance = dist_vec( pos_global, relative_to );
		if( distance <= radius )
		{
			avatar_ids.push_back( mMapAvatarIDs.get(i) );
		}
	}
}
开发者ID:greythane,项目名称:slitechat,代码行数:19,代码来源:llviewerregion.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ distance函数代码示例发布时间:2022-05-30
下一篇:
C++ dissector_try_uint函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap