void GetNearestSpawnPosition( const Vector3f &vIn, Vector3f &vOut, Angle3d &aOut ) { std::vector<CVehicleRespawnPosition*> &poss = singletons::g_pWorld->getRespawnPositions(); if( poss.empty() ) return; UINT index = 0; float mindistsq = VectorLengthSq( poss[0]->GetOrigin() - vIn ); for( UINT i = 1; i < poss.size(); i++ ) { float length = VectorLengthSq( poss[i]->GetOrigin() - vIn ); if( length < mindistsq ) { mindistsq = length; index = i; } } vOut = poss[index]->GetOrigin(); aOut = poss[index]->GetAngle(); }
void UpdateFaceSphere(face_t *in) { int i; vec3_t radius; vec_t lensq; MidpointWinding(&in->w, in->origin); in->radius = 0; for (i = 0; i < in->w.numpoints; i++) { VectorSubtract(in->w.points[i], in->origin, radius); lensq = VectorLengthSq(radius); if (lensq > in->radius) in->radius = lensq; } in->radius = sqrt(in->radius); }
float Lapidem_Math::VectorLength( TVECTOR _v ) { return sqrtf( VectorLengthSq( _v ) ); }
vec_t VectorLength(const vec3_t v) { return sqrt(VectorLengthSq(v)); }