diff options
author | Ricky Curtice <kf6kjg+hg@gmail.com> | 2011-03-10 22:07:06 -0800 |
---|---|---|
committer | Ricky Curtice <kf6kjg+hg@gmail.com> | 2011-03-10 22:07:06 -0800 |
commit | d4d292258e31eee6d639106147758f39deae63e3 (patch) | |
tree | 577571cc2d4cdef5aa24706520b790f56b875c1c /indra/newview/llworld.cpp | |
parent | 1426765e82549ec9d17a0f90d902f25c0e785bbd (diff) |
Squared all dist_vec() based comparisons and other dist_vec() operations where sensible.
Not all instances of dist_vec() were squared, only those where it wouldn't (hopefully) change the functionality.
Diffstat (limited to 'indra/newview/llworld.cpp')
-rw-r--r-- | indra/newview/llworld.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 8f7197c607..a21a7eac9e 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1446,6 +1446,8 @@ static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3 void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const { + F32 radius_squared = radius * radius; + if(avatar_ids != NULL) { avatar_ids->clear(); @@ -1463,7 +1465,7 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi 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(dist_vec_squared(pos_global, relative_to) <= radius_squared) { if(positions != NULL) { @@ -1491,7 +1493,7 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi if(uuid.isNull()) continue; LLVector3d pos_global = pVOAvatar->getPositionGlobal(); - if(dist_vec(pos_global, relative_to) <= radius) + if(dist_vec_squared(pos_global, relative_to) <= radius_squared) { bool found = false; uuid_vec_t::iterator sel_iter = avatar_ids->begin(); |